Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test Python 3.9-3.13 on windows/mac/linux #465

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

dbast
Copy link
Contributor

@dbast dbast commented Nov 20, 2024

This PR introduces several changes enhance the testing infrastructure and test compatibility with newer Python versions:

  1. CI Configuration Updates:

    • Matrix Strategy for Python Versions and OS:
      • Updated the GitHub Actions workflow to test against a matrix of Python versions (3.9 to 3.13) and operating systems (Ubuntu, Windows, macOS). This ensures that the library is compatible with the most commonly used Python versions and operating systems.
      • Removed Python 3.8 from the testing matrix as it already reached its end of life (EOL)
    • Parallel Test Execution:
      • Introduced parallel test execution using pytest-xdist to speed up the testing process. This is achieved by running tests in parallel (-n auto).
      • Updated the Makefile to include a tests-parallel target for running tests in parallel.
    • Artifact Uploads:
      • Configured the workflow to upload HTML coverage reports for better visualization and debugging of test coverage during local dev work.
      • Ensured that coverage reports are uploaded only for the main repository to avoid issues while working in forks.
  2. Dependency Management:

    • Updated pyproject.toml:
      • Updated the Python version requirement to ^3.9 to reflect the new supported range.
      • Added new dependencies: pytest-html for generating HTML reports and pytest-xdist for parallel test execution.
    • Recreated poetry.lock:
      • Recreated the poetry.lock file to ensure compatibility with the new Python version range and to include the new test dependencies.
  3. Testing Enhancements:

    • Docker Integration:
      • Updated the docker-compose.yml file to remove explicit port assignments. This allows Docker to assign random ports, preventing port conflicts during parallel test execution.
    • Test Fixtures:
      • Changed the scope of test fixtures from session to module to ensure that each test module has its own isolated environment (like it was archived before via the integration test matrix).
      • Updated test fixtures to use the docker_ip and docker_services fixtures from pytest-docker to dynamically determine the IP and ports of Docker services (required for parallel execution).
    • Test Execution:
      • Consolidated the test execution strategy to run all tests in parallel on Ubuntu (make tests-parallel) and run unit tests separately on other operating systems for efficiency.
      • fold pytest.ini + more pytest args/settings into pyproject.toml
      • execute make target in test workflow
  4. Miscellaneous:

    • Updated .gitignore:
      • Added entries for coverage.xml and htmlcov/ to ignore coverage reports generated during local development.
    • Updated README.md:
      • Added a badge for supported Python versions to provide quick visibility into the compatibility of the library.
    • Updates to Makefile / bin/localnet.sh:
      • Marked all targets as PHONY as they do not relate to files named like the target (and would not run if such file exist)
      • fixed the shebang in localnet.sh and call it directly (without sh) in the Make targets so that the right shell (=bash) is used.

PR diff without poetry.lock would be 87 insertions(+), 114 deletions(-). No changes done ./src/* by this PR.

The execution time of all tests on linux (unit+ doc + integration tests) now have a similar time compared to one integration module before. On win + macos only the unit+doc tests can be run, as there is no ability to start the localnet container on action runners.

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.00%. Comparing base (3f40b01) to head (64eeede).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #465      +/-   ##
==========================================
+ Coverage   90.20%   91.00%   +0.80%     
==========================================
  Files          28       28              
  Lines        2245     2380     +135     
==========================================
+ Hits         2025     2166     +141     
+ Misses        220      214       -6     
---- 🚨 Try these New Features:

Copy link
Owner

@michaelhly michaelhly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks again.

@michaelhly michaelhly merged commit b14dde1 into michaelhly:master Nov 20, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants