Skip to content

Unify temporary directory allocation strategy in tests - #64

Merged
cottsay merged 2 commits into
colcon:masterfrom
KmoM88:KmoM88/tmp-path
Aug 29, 2026
Merged

Unify temporary directory allocation strategy in tests#64
cottsay merged 2 commits into
colcon:masterfrom
KmoM88:KmoM88/tmp-path

Conversation

@KmoM88

@KmoM88 KmoM88 commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Following the upstream unification in colcon/colcon-core#729, this PR refactors the test suite to use the modern tmp_path fixture (which provides a pathlib.Path object) instead of mixing multiple temporary directory strategies.

Specifically, this package previously used:

  • Manual TemporaryDirectory management (in test/test_package_identification_python_setup_py.py)

This refactor:

  1. Adds a test/conftest.py compatibility fixture for tmp_path (supporting older pytest versions, such as those on Enterprise Linux 8).
  2. Updates test/test_package_identification_python_setup_py.py to accept and utilize the tmp_path fixture, removing the manual context manager.
  3. Cleans up redundant global references in test/test_spell_check.py to prevent style guide validation errors on newer flake8 configurations.
  4. Updates test/spell_check.words to include words introduced by the compatibility fixture (isdigit, itertools, linux, takewhile, tmpdir) and removes the now-unused tempfile.

Reference

Specifics

colcon-python-setup-py relied entirely on manual TemporaryDirectory context manager blocks.

🤖 Assisted by Gemini

@codecov-commenter

codecov-commenter commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 51.00%. Comparing base (9199b24) to head (eafeaa8).

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #64   +/-   ##
=======================================
  Coverage   51.00%   51.00%           
=======================================
  Files           3        3           
  Lines         149      149           
  Branches       23       23           
=======================================
  Hits           76       76           
  Misses         67       67           
  Partials        6        6           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@cottsay
cottsay merged commit 45d0a04 into colcon:master Aug 29, 2026
22 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.

3 participants