-
Notifications
You must be signed in to change notification settings - Fork 368
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
Skipped test in test_coding_standards #2278
base: main
Are you sure you want to change the base?
Conversation
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.
Looks like this is being hit in CI now.
REPO_DIR = subprocess.Popen(['git', 'rev-parse', '--show-toplevel'], | ||
stdout=subprocess.PIPE | ||
).communicate()[0].rstrip().decode('utf-8') | ||
REPO_DIR = Path(REPO_DIR) |
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.
Do we need to keep supporting CARTOPY_GIT_DIR
?
REPO_DIR = Path(REPO_DIR) | |
REPO_DIR = Path(os.getenv("CARTOPY_GIT_DIR", REPO_DIR)) |
This might be problematic for downstream packagers if they put their stuff in git and Cartopy is unpacked in that directory. But downstream packagers probably don't want to check stylistic things like this, so tests like this should probably get a pytest marker so they can be skipped. |
c921c41
to
b932312
Compare
Over at SciTools/cf-units#364 (comment), @pelson suggested these checks would be better via pre-commit hooks. I found this insert-license is a supported hook. Edit: I opened SciTools/.github#22 to see if Iris wants to do something like that. If they do, we could just follow. |
Rationale
The CI server gives a message like: "SKIPPED [1] ../../../../../opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12/site-packages/cartopy/tests/test_coding_standards.py:78: cartopy installation did not look like a git repo: /opt/hostedtoolcache/Python/3.12.0/x64/lib/python3.12 is not a git repository." suggesting it cannot find the root directory (locally seems to work fine).
Implications
This PR tries a different approach to finding the git repository location so the test [which checks the license headers] will not be skipped.