I
I
Ivan Petrov2017-01-24 14:34:21
Python
Ivan Petrov, 2017-01-24 14:34:21

What does deselected mean in Pytest?

I'm trying to figure it out with pytest.

import pytest


@pytest.fixture()
def resource_setup(request):
    print("\nresource_setup")

    def resource_teardown():
        print("\nresource_teardown")

    request.addfinalizer(resource_teardown)


def test_1_that_needs_resource(resource_setup):
    print("test_1_that_needs_resource")


def test_2_that_does_not():
    print("test_2_that_does_not")


def test_3_that_does_again(resource_setup):
    print("test_3_that_does_again")

In this example, everything starts fine only if there is no line break \n in print . Then everything comes out as it should. If I add a line break, 2 tests are skipped. What am I doing wrong, why are the tests skipped?
============================= test session starts =============================
platform win32 -- Python 3.5.2, pytest-3.0.5, py-1.4.32, pluggy-0.4.0
rootdir: D:\[PYTHON\_learn\py_test, inifile: 
collected 3 items

test_my_fixt.py 
resource_setup
test_3_that_does_again
.
resource_teardown


============================= 2 tests deselected ==============================
=================== 1 passed, 2 deselected in 0.03 seconds ====================

Answer the question

In order to leave comments, you need to log in

1 answer(s)
U
Ulyana Illiterate, 2017-01-25
@karulyana

from pprint import pprint
pprint([1,1,1,1,1,1,1])
might be useful

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question