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

bdd_features_base_dir is relative to pytest rootdir #573

Merged
merged 2 commits into from
Nov 4, 2022

Conversation

drothlis
Copy link
Contributor

@drothlis drothlis commented Nov 4, 2022

The pytest rootdir is the directory containing pytest.ini (or similar):
https://docs.pytest.org/en/latest/reference/customize.html#rootdir

This pull request allows you to run pytest when the current working directory isn't the same as the directory containing the tests. I need to do that because in my system, the directory containing the tests is on a read-only filesystem (and my tests themselves write files to the current directory).

TODO:

@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Base: 98.50% // Head: 98.52% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (df7af76) compared to base (ab9903b).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #573      +/-   ##
==========================================
+ Coverage   98.50%   98.52%   +0.02%     
==========================================
  Files          32       32              
  Lines         735      745      +10     
  Branches       16       16              
==========================================
+ Hits          724      734      +10     
  Misses          9        9              
  Partials        2        2              
Impacted Files Coverage Δ
tests/feature/test_feature_base_dir.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

The pytest rootdir is the directory containing pytest.ini (or similar):
https://docs.pytest.org/en/latest/reference/customize.html#rootdir

This allows you to run pytest when the current working directory isn't
the same as the directory containing the tests. I need to do that
because in my system, the directory containing the tests is on a
read-only filesystem.
@drothlis
Copy link
Contributor Author

drothlis commented Nov 4, 2022

Rebased onto master now that #572 is merged.

@drothlis drothlis marked this pull request as ready for review November 4, 2022 10:44
@drothlis
Copy link
Contributor Author

drothlis commented Nov 4, 2022

@youtux thanks for the very quick review of all my recent pull requests. This is the last one (for now, at least). This was my initial goal before I got sidetracked with the other fixes & tidy-ups. :-)

This fixes invoking pytest from a directory outside of the rootdir. The behaviour hasn't changed for users who invoke pytest from the same directory as the rootdir (i.e. most users).

@drothlis drothlis requested a review from youtux November 4, 2022 11:04
@youtux
Copy link
Contributor

youtux commented Nov 4, 2022

LGTM! Would you mind adding an entry to the change log file with this? I think it's worth adding the fix there

@youtux youtux enabled auto-merge November 4, 2022 19:09
@youtux youtux merged commit 2a649af into pytest-dev:master Nov 4, 2022
@drothlis drothlis deleted the rootdir branch November 4, 2022 19:26
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