New issue 723: module scope fixture invoked multiple times if using test node 
specifiers for same module
https://bitbucket.org/pytest-dev/pytest/issue/723/module-scope-fixture-invoked-multiple

Sandeep Kasargod:

Using Version 2.6.4

The attachment mytest.py defines a module scoped fixture used by two tests.
Running the tests with method 1 or 2 results in the fixture setup once only as 
expected. However if I use method 3, where I specify the two test nodes 
explicitly, looks like they are always treated as two separate modules. 
Is this expected behavior or should pytest do module coalescing when test 
collection takes place ?

The reason I want to use method 3 is to be able to use a text file that 
specifies the tests using the test node syntax as in method 3

1) py.test  mytest.py -v -s
2) py.test  mytest.py -v -s -k 'test_1 or test_2'

```
#!python

mytest.py::test_1 
> module_fixture_start

TEST1
PASSED
mytest.py::test_2 
TEST2
PASSED
< module_fixture_cleanup
```

3) py.test  mytest.py::test_1 mytest.py::test_2 -v -s


```
#!python

platform linux2 -- Python 2.7.5 -- py-1.4.26 -- pytest-2.6.4 -- 
/home/vxbuild/python_virtualenv/bin/python
collected 6 items 

mytest.py::test_1 
> module_fixture_start

TEST1
PASSED
< module_fixture_cleanup

mytest.py::test_2 
> module_fixture_start

TEST2
PASSED
< module_fixture_cleanup

```



_______________________________________________
pytest-commit mailing list
pytest-commit@python.org
https://mail.python.org/mailman/listinfo/pytest-commit

Reply via email to