-
Notifications
You must be signed in to change notification settings - Fork 5.3k
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
Let run tests directly via python test_xyz.py
, fix for conftest
import via sys.path.append
#1144
Conversation
python test_xyz.py
, fix for contest
import via sys.path.append
python test_xyz.py
, fix for conftest
import via sys.path.append
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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_openai
and also checked the test can be run directly.Related issue number
Closes #1120 and #1137
Checks