Let run tests directly via python test_xyz.py, fix for conftest import via sys.path.append#1144
Let run tests directly via python test_xyz.py, fix for conftest import via sys.path.append#1144sonichi merged 3 commits intomicrosoft:mainfrom maxim-saplin:conftest-import-fix
python test_xyz.py, fix for conftest import via sys.path.append#1144Conversation
python test_xyz.py, fix for contest import via sys.path.appendpython test_xyz.py, fix for conftest import via sys.path.append
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1144 +/- ##
==========================================
+ Coverage 30.74% 40.39% +9.64%
==========================================
Files 30 30
Lines 4043 4043
Branches 915 964 +49
==========================================
+ Hits 1243 1633 +390
+ Misses 2721 2299 -422
- Partials 79 111 +32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
I think this is generally fine.
I think it's worth considering in the future how we maybe restructure the tests directory to maybe ameliorate this, and the need to add both the parent and grandparent paths.
Adding so many non-standard system paths feels a little suboptimal.
Totally agree and I don't like the smell of the PR :) IMO it is better to drop the requirement to have the tests runnable by theirselves and revert to tooling (such as PyTest or IDE) - this will also allow to avoid adding main part at the bottom of files |
For me, the main part is a convenient way of selecting just the functions I want to run manually, without having to be in the IDE, or having to run pytest. |
|
@rickyloynd-microsoft Yes, it's a pain (and not always ideal possible) to run every test in the file when trying to iterate on, or develop, one specific test (e.g. that you are adding for a new PR or something). Obviously we want to run ALL tests before committing, but it's not necessary when trying to step through or debug one particular one. |
…mport via `sys.path.append` (microsoft#1144) * Runnig tests directly * All tests with contrib add sys.path
I have added
sys.path.append()before allfrom conftest import skip_openaiand also checked the test can be run directly.Related issue number
Closes #1120 and #1137
Checks