That's exactly what I was looking for -- thanks!

-ofer

On 04/16/2013 04:09 PM, holger krekel wrote:
Hi Ofer,

maybe this solution is more to your liking?

     
http://pytest.org/latest/example/simple.html#control-skipping-of-tests-according-to-command-line-option

cheers,
holger


On Tue, Apr 16, 2013 at 15:49 -0400, Ofer Nave wrote:
I do have a working implementation with the following:

1) Create a marker:

slow = pytest.mark.skipif("'SLOW' not in os.environ")

2) Mark appropriate tests:

@slow
def test_which_is_slow():
     ...

3) Turn on slow tests from command line:

$ SLOW=1 py.test

Not exactly the form factor I was looking for, but it does work.

-ofer

On 04/16/2013 03:39 PM, Ofer Nave wrote:
I understand I can mark tests with `@pytest.mark.whatever` and run
them specifically with `pytest -m whatever`, or run skip them with
`pytest -m 'not whatever'`.  But how I can configure pytest in my
package such that the default behavior is to skip those tests?

Specifically, I have some tests that are very slow (multiple
seconds each).  I want to mark them 'slow', and have the default
behavior when running `pytest` be to skip them.  That way they
will only run if you explicitly run them with `pytest -m slow`.

Is there a way to configure this in conftest.py?

-ofer
_______________________________________________
Pytest-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-dev
_______________________________________________
Pytest-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-dev


_______________________________________________
Pytest-dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to