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

Exitcode skips #153

Merged
merged 11 commits into from
Nov 25, 2022
Merged

Exitcode skips #153

merged 11 commits into from
Nov 25, 2022

Conversation

lucasvanb
Copy link
Contributor

@lucasvanb lucasvanb commented Nov 18, 2022

Checklist

  • Pull request details were added to HISTORY.rst

@@ -443,20 +443,21 @@ def collect(self):
# collection phase.
workflow = self.queue_workflow()

workflow.desired_exit_code = self.workflow_test.exit_code
Copy link
Member

Choose a reason for hiding this comment

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

It is better to do this in the self.queue_workflow function so that the desired exit code can be set upon class instantion rather than bolted on later.

@@ -69,6 +69,7 @@ def __init__(self,
self._started = False
self.errors: List[Exception] = []
self.start_lock = threading.Lock()
self.desired_exit_code = 0
Copy link
Member

Choose a reason for hiding this comment

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

This value should be set trough the __init__ parameters as it should be user configurable.

src/pytest_workflow/workflow.py Show resolved Hide resolved
""")


def test_skips(pytester):
pytester.makefile(".yml", test=SKIP_TESTS)
result = pytester.runpytest("-v").parseoutcomes()
assert {"failed": 4, "passed": 3, "skipped": 3} == result
assert {"failed": 5, "passed": 3, "skipped": 7} == result
Copy link
Member

Choose a reason for hiding this comment

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

By having one combined result this makes the test prone to errors later. Two test units might fail in a way that the outcomes compensate for eachother. Also it makes it harder to adopt the test as you need to count all the units together to see what the expected numbers are. That is 15 tests to keep track of in your head. It is better to test the 3 units separately.

src/pytest_workflow/workflow.py Show resolved Hide resolved
Copy link
Member

@rhpvorderman rhpvorderman left a comment

Choose a reason for hiding this comment

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

Almost there. The tests you removed however test functionality that should remain tested. Please do not remove these tests.

tests/test_fail_messages.py Show resolved Hide resolved
tests/test_fail_messages.py Show resolved Hide resolved
@rhpvorderman
Copy link
Member

Nicely removed the test dependency on grep! (This has some LOCALE issues, on my Dutch machine at home the messages are different.)

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