-
Notifications
You must be signed in to change notification settings - Fork 55
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
Issue #402: Fix tests that fail as a result of running pytest
with no flags
#404
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,6 +103,10 @@ def run_main(argv: Optional[List[str]] = None) -> int: | |
sys.stderr.write(f"{VERSION_INFO}\n") | ||
return 0 | ||
|
||
# If the command run is not pyani (e.g., `pytest`, then we | ||
# don't want to apply pyani-specific checks) | ||
if len(sys.argv) == 1 and not sys.argv[0].endswith("pyani"): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand why There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because
The same goes for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. It would be more robust to either (i) treat >>> from pathlib import Path
>>> pyani_path = "/my/path/to/pyani"
>>> notpyani_path = "/my/path/to/notpyani"
>>> Path(pyani_path).name
'pyani'
>>> Path(notpyani_path).name
'notpyani'
>>> pyani_path.split("/")[-1]
'pyani'
>>> notpyani_path.split("/")[-1]
'notpyani'
>>> pyani_path.endswith("pyani")
True
>>> notpyani_path.endswith("pyani")
True There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mentioned in our last meeting that I'd thought of a better way to do it, and I think I said that was using a I must have misunderstood; I can of course use |
||
pass | ||
# Catch requests for citation and version information | ||
if sys.argv[1].startswith("-"): | ||
if args.citation: | ||
|
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 don't understand why
endswith()
is used in preference to==
. What is your thinking, here?Also, the
pyani
command would not executeaverage_nucleotide_identity.py
- the command for this isaverage_nucleotide_identity.py
(see this line), so should this not be testing foraverage_nucleotide_identity.py
rather thanpyani
?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.
For the
==
part, see my response below.Yes, you're right; that was a mistake on my part.
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.
So long as you make the change such that v0.2 tests for
average_nucleotide_identity.py
this part of the conversation can be resolved.