Skip to content

Do not exit if pytest version check fails#498

Merged
j-rivero merged 1 commit intomasterfrom
jacob/no_exit_on_error
Aug 6, 2020
Merged

Do not exit if pytest version check fails#498
j-rivero merged 1 commit intomasterfrom
jacob/no_exit_on_error

Conversation

@jacobperron
Copy link
Copy Markdown
Member

Fixes failing CI builds for dashing, eloquent, and foxy.

Addresses #471 (comment)

Before: Build Status
After: Build Status

Fixes failing CI builds for dashing, eloquent, and foxy.

Signed-off-by: Jacob Perron <jacob@openrobotics.org>
@nuclearsandwich
Copy link
Copy Markdown
Member

@j-rivero can you comment on your intention here? If I had to guess I'd say that exit_on_error was added without realizing it would halt the build since what you're trying to capture is whether pytest >=6.0.0 is present not assert that it is. If that's the case then this PR looks like it exhibits the originally intended behavior.

Copy link
Copy Markdown
Member

@nuclearsandwich nuclearsandwich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me but I'd like @j-rivero to confirm.

@j-rivero
Copy link
Copy Markdown

j-rivero commented Aug 6, 2020

@j-rivero can you comment on your intention here? If I had to guess I'd say that exit_on_error was added without realizing it would halt the build since what you're trying to capture is whether pytest >=6.0.0 is present not assert that it is. If that's the case then this PR looks like it exhibits the originally intended behavior.

That was the intention originally, yes. Not sure why it was not catch during my initial tests in pull request #471. Thanks @jacobperron, @nuclearsandwich for the fix.

@j-rivero j-rivero merged commit e594bdb into master Aug 6, 2020
@delete-merged-branch delete-merged-branch bot deleted the jacob/no_exit_on_error branch August 6, 2020 13:40
'sys.exit(StrictVersion(pytest.__version__) >= StrictVersion("6.0.0"))'
"'"])
"'"],
exit_on_error=False)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using the return value for both the version comparison result as well as potential errors looks fragile to me. I would suggest to refactor this logic to:

  • either print the version comparison result (and interpret the output) and ensure that the command has a return code of zero
  • or just print pytest.__version__ and perform the comparison in the calling Python code rather than within the invoked command.

@jacobperron
Copy link
Copy Markdown
Member Author

This patch does not work as it appears the result job.run is always True. I should have tested with a package that involves a pytest.ini file, my mistake.

@j-rivero
Copy link
Copy Markdown

j-rivero commented Aug 7, 2020

This patch does not work as it appears the result job.run is always True. I should have tested with a package that involves a pytest.ini file, my mistake.

I'm testing a fix for the problem, based on Dirk's suggestion: master...shell_pytest6

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.

4 participants