Skip to content

Conversation

@gdyuldin
Copy link
Contributor

This parameter allows to change test execution order.
For example, with --repeat-scope session all tests executes
first time, next all tests executes second time and etc.

@gdyuldin
Copy link
Contributor Author

Fixes #19

Copy link
Contributor

@davehunt davehunt left a comment

Choose a reason for hiding this comment

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

How does this work when @pytest.mark.repeat(n) is applied to a class or another scope? Also, could you add some documentation for this new feature to the README?

@gdyuldin
Copy link
Contributor Author

Applying @pytest.mark.repeat(n) to the test class works like applying this mark to each test in this class.
README updated.

Copy link
Contributor

@davehunt davehunt left a comment

Choose a reason for hiding this comment

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

Awesome, thanks @gdyuldin! I've tested this out locally and it works really well. I just had a few comments on the documentation, but once they're taken care of I'd be happy to push a new release.

README.rst Outdated
pass
If you want to override default tests executions order, you can use :code:`--repeat-scope`
command line option with one of the next values: :code:`session`, :code:`module`, :code:`class` of :code:`function`(default).
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: 'of' instead of 'or'

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, function is not rendoring correctly, see https://github.com/gdyuldin/pytest-repeat/blob/31c85c7f9398b729c8c4abf46f491ea6512054ea/README.rst. I suspect you need a space before "(default)".

README.rst Outdated
If you want to override default tests executions order, you can use :code:`--repeat-scope`
command line option with one of the next values: :code:`session`, :code:`module`, :code:`class` of :code:`function`(default).
It behaves like a scope of the py.test fixture.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please use "pytest" and not "py.test", as the dot was dropped in version 3.

README.rst Outdated
:code:`function` (default) scope repeats each test :code:`count` or :code:`repeat` times before executing next test.
:code:`session` scope repeats whole tests session, i.e. all collected tests executed once, then all such tests executed again and etc.
:code:`class` and :code: `module` behaves similar, but repeating tests block is all tests for class or module.
Copy link
Contributor

Choose a reason for hiding this comment

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

module is not formatted, likely due to the space after ":code:"

Copy link
Contributor

Choose a reason for hiding this comment

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

It's not clear what you mean by "repeating tests block is all tests for class or module". Could you rephrase?

This parameter allows to change test execution order.
For example, with `--repeat-scope session` all tests executes
first time, next all tests executes second time and etc.
@gdyuldin
Copy link
Contributor Author

gdyuldin commented Aug 1, 2018

I've updated README

@davehunt davehunt merged commit 56aa32d into pytest-dev:master Aug 1, 2018
@gdyuldin gdyuldin deleted the add_scope branch August 1, 2018 07:52
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