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

Adjust unit test infrastructure to facilitate running tests via IDEs #289

Merged
merged 2 commits into from
Jun 13, 2024
Merged

Adjust unit test infrastructure to facilitate running tests via IDEs #289

merged 2 commits into from
Jun 13, 2024

Conversation

per1234
Copy link
Collaborator

@per1234 per1234 commented Jun 13, 2024

The previous configuration worked fine when running pytest directly or via the python:test task. However, some complex configuration of Python IDEs was necessary in order to run the tests via their convenient UI, making the project less friendly to contributors.

The new configuration should allow IDEs to automatically discover tests and run them correctly without any special configuration.

per1234 added 2 commits June 13, 2024 12:53
The previous location worked fine when running pytest directly or via the task. It was also possible to run the tests
from the PyCharm UI after a bit of configuration. However, I had no luck with using the VS Code test explorer.

VS Code is likely to be the most common development environment of contributors so it will be important to make it easy
to use with VS Code. Moving pytest.ini file to the root of the repository allowed the VS Code test explorer to correctly
recognize it.
Previously, the python:test task set PYTHONPATH via environment variable. That approach is fine when running the tests
via the task, but meant that PYTHONPATH was not correctly configured when running the tests via the interface of an IDE.
Each contributor would be forced to configure their IDE in order to allow it to run the tests successfully.

Configuring PYTHONPATH via the pytest.ini file makes this universal.
@per1234 per1234 added type: enhancement Proposed improvement topic: infrastructure Related to project infrastructure labels Jun 13, 2024
@per1234 per1234 self-assigned this Jun 13, 2024
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.81%. Comparing base (b35a113) to head (dbee8d0).
Report is 11 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #289   +/-   ##
=======================================
  Coverage   99.81%   99.81%           
=======================================
  Files           2        2           
  Lines        1608     1623   +15     
=======================================
+ Hits         1605     1620   +15     
  Misses          3        3           

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

@per1234 per1234 merged commit 494d528 into arduino:main Jun 13, 2024
40 of 41 checks passed
@per1234 per1234 deleted the pythonpath branch June 13, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: infrastructure Related to project infrastructure type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants