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

test_cli_parsing() tests fail when pytest is run with no flags #402

Open
baileythegreen opened this issue Jun 9, 2022 · 1 comment · May be fixed by #404
Open

test_cli_parsing() tests fail when pytest is run with no flags #402

baileythegreen opened this issue Jun 9, 2022 · 1 comment · May be fixed by #404
Labels
bug something isn't working how it should interface issues related to how the user tells pyani to do something tests issues relating to tests
Milestone

Comments

@baileythegreen
Copy link
Contributor

Summary:

When running:

pytest

on its own, test_cli_parsing() fails. However, if one runs:

pytest -k cli_test_parsing

pytest -v

or anything command that has more than one element to the command line, those tests pass.

It seems to be related to this line in pyani_script.py:

# Catch requests for citation and version information
if sys.argv[1].startswith("-"):

Reproducible Steps:

Run pytest with no options.

Current Output:

IndexError: list index out of range

It is difficult to provide more complete information about the error as attempts to increase the verbosity eliminate the bug.

Expected Output:

Describe what you expect the output to be. It is also very useful to know the expected "correct" behavior on your systems.

pyani Version:

bleeding edge

installed dependencies

If you are running a version of pyani v0.3 or later, then please run the command pyani listdeps at the command line, and enter the output below.

Python Version:

3.8.10

Operating System:

macOS High Sierra

@baileythegreen baileythegreen added bug something isn't working how it should interface issues related to how the user tells pyani to do something tests issues relating to tests labels Jun 9, 2022
@baileythegreen baileythegreen added this to the 0.3.0 milestone Jun 9, 2022
@widdowquinn
Copy link
Owner

The obvious workaround is to use pytest -v in preference to pytest.

A good fix may be to catch sys.argv just ahead of the line you indicate and check for pytest being called with no arguments, skipping the attempt to catch citation/version information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug something isn't working how it should interface issues related to how the user tells pyani to do something tests issues relating to tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants