Skip to content

Commit 3f8b847

Browse files
committed
Merge branch 'release/0.5.0'
2 parents ee1293e + f4e5c23 commit 3f8b847

22 files changed

+1112
-108
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
*~
33
.cache/
44
__pycache__/
5-
/.gitrevision
5+
/.version
66
/MANIFEST
77
/build/
88
/dist/

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
include .version
12
include LICENSE.txt
23
include MANIFEST.in
34
include README.rst

Makefile

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ build:
88
test: build
99
PYTHONPATH=$(BUILDDIR)/lib $(PYTHON) -m pytest tests
1010

11-
sdist: .gitrevision
11+
sdist:
1212
$(PYTHON) setup.py sdist
1313

14-
doc-html:
14+
doc-html: .version
1515
$(MAKE) -C doc html
1616

1717
clean:
@@ -20,17 +20,15 @@ clean:
2020
$(MAKE) -C doc clean
2121

2222
distclean: clean
23-
rm -rf .cache tests/.cache
24-
rm -f MANIFEST
23+
rm -rf .cache tests/.cache .pytest_cache tests/.pytest_cache
2524
rm -f *.pyc tests/*.pyc
2625
rm -rf __pycache__ tests/__pycache__
26+
rm -f MANIFEST .version
2727
rm -rf dist
2828
rm -rf pytest_dependency.egg-info
29-
rm -rf .pytest_cache
3029
$(MAKE) -C doc distclean
3130

32-
.gitrevision:
33-
git describe --always --dirty > .gitrevision
31+
.version:
32+
$(PYTHON) setup.py check
3433

35-
36-
.PHONY: build test sdist doc-html clean distclean .gitrevision
34+
.PHONY: build test sdist doc-html clean distclean

README.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,16 @@ System requirements
2424
+ `setuptools`_.
2525
+ `pytest`_ 3.6.0 or newer.
2626

27+
Optional library packages:
28+
29+
+ `setuptools_scm`_
30+
31+
The version number is managed using this package. All source
32+
distributions add a static text file with the version number and
33+
fall back using that if `setuptools_scm` is not available. So this
34+
package is only needed to build out of the plain development source
35+
tree as cloned from GitHub.
36+
2737

2838
Installation
2939
------------
@@ -79,3 +89,4 @@ permissions and limitations under the License.
7989

8090
.. _setuptools: http://pypi.python.org/pypi/setuptools/
8191
.. _pytest: http://pytest.org/
92+
.. _setuptools_scm: https://github.com/pypa/setuptools_scm/

doc/examples/basic.out

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
$ py.test -rsx basic.py
1+
$ pytest -rsx basic.py
22
============================= test session starts ==============================
3-
platform linux -- Python 3.4.6, pytest-2.8.7, py-1.4.30, pluggy-0.3.1
4-
rootdir: /home/user/pytest-dependency-0.2, inifile:
5-
plugins: dependency-0.2
6-
collected 5 items
3+
platform linux -- Python 3.8.1, pytest-5.3.4, py-1.8.1, pluggy-0.13.1
4+
rootdir: /home/user/tests
5+
plugins: dependency-0.4.0
6+
collected 5 items
7+
8+
basic.py x.s.s [100%]
79

8-
basic.py x.s.s
910
=========================== short test summary info ============================
10-
SKIP [1] /usr/lib/python3.4/site-packages/pytest_dependency.py:65: test_e depends on test_c
11-
SKIP [1] /usr/lib/python3.4/site-packages/pytest_dependency.py:65: test_c depends on test_a
11+
SKIPPED [1] /usr/lib/python3.8/site-packages/pytest_dependency.py:87: test_c depends on test_a
12+
SKIPPED [1] /usr/lib/python3.8/site-packages/pytest_dependency.py:87: test_e depends on test_c
1213
XFAIL basic.py::test_a
1314
deliberate fail
14-
15-
================ 2 passed, 2 skipped, 1 xfailed in 0.02 seconds ================
15+
=================== 2 passed, 2 skipped, 1 xfailed in 0.06s ====================

doc/examples/nodeid.out

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
$ pytest --verbose
2+
============================= test session starts ==============================
3+
platform linux -- Python 3.8.1, pytest-5.3.4, py-1.8.1, pluggy-0.13.1 -- /usr/bin/python3
4+
cachedir: .pytest_cache
5+
rootdir: /home/user
6+
plugins: dependency-0.4.0
7+
collected 7 items
8+
9+
tests/test_nodeid.py::test_a PASSED [ 14%]
10+
tests/test_nodeid.py::test_b[7-True] PASSED [ 28%]
11+
tests/test_nodeid.py::test_b[0-False] PASSED [ 42%]
12+
tests/test_nodeid.py::test_b[-1-False] XFAIL [ 57%]
13+
tests/test_nodeid.py::TestClass::test_c PASSED [ 71%]
14+
tests/test_nodeid.py::TestClass::test_d[order] PASSED [ 85%]
15+
tests/test_nodeid.py::TestClass::test_d[disorder] PASSED [100%]
16+
17+
========================= 6 passed, 1 xfailed in 0.08s =========================

doc/examples/nodeid.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import random
2+
import pytest
3+
4+
def test_a():
5+
pass
6+
7+
@pytest.mark.parametrize("i,b", [
8+
(7, True),
9+
(0, False),
10+
pytest.param(-1, False, marks=pytest.mark.xfail(reason="nonsense"))
11+
])
12+
def test_b(i, b):
13+
assert bool(i) == b
14+
15+
ordered = list(range(10))
16+
unordered = random.sample(ordered, k=len(ordered))
17+
18+
class TestClass:
19+
20+
def test_c(self):
21+
pass
22+
23+
@pytest.mark.parametrize("l,ll", [(ordered, 10), (unordered, 10)],
24+
ids=["order", "disorder"])
25+
def test_d(self, l, ll):
26+
assert len(l) == ll

doc/examples/scope_class.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import pytest
2+
3+
@pytest.mark.dependency()
4+
@pytest.mark.xfail(reason="deliberate fail")
5+
def test_a():
6+
assert False
7+
8+
9+
class TestClass1(object):
10+
11+
@pytest.mark.dependency()
12+
def test_b(self):
13+
pass
14+
15+
16+
class TestClass2(object):
17+
18+
@pytest.mark.dependency()
19+
def test_a(self):
20+
pass
21+
22+
@pytest.mark.dependency(depends=["test_a"])
23+
def test_c(self):
24+
pass
25+
26+
@pytest.mark.dependency(depends=["test_a"], scope='class')
27+
def test_d(self):
28+
pass
29+
30+
@pytest.mark.dependency(depends=["test_b"], scope='class')
31+
def test_e(self):
32+
pass

doc/examples/scope_module.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import pytest
2+
3+
@pytest.mark.dependency()
4+
@pytest.mark.xfail(reason="deliberate fail")
5+
def test_a():
6+
assert False
7+
8+
@pytest.mark.dependency()
9+
def test_b():
10+
pass
11+
12+
@pytest.mark.dependency(depends=["test_a"], scope='module')
13+
def test_c():
14+
pass
15+
16+
@pytest.mark.dependency(depends=["test_b"], scope='module')
17+
def test_d():
18+
pass
19+
20+
@pytest.mark.dependency(depends=["test_b", "test_c"], scope='module')
21+
def test_e():
22+
pass

doc/examples/scope_session_mod_01.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# test_mod_01.py
2+
3+
import pytest
4+
5+
@pytest.mark.dependency()
6+
def test_a():
7+
pass
8+
9+
@pytest.mark.dependency()
10+
@pytest.mark.xfail(reason="deliberate fail")
11+
def test_b():
12+
assert False
13+
14+
@pytest.mark.dependency(depends=["test_a"])
15+
def test_c():
16+
pass
17+
18+
19+
class TestClass(object):
20+
21+
@pytest.mark.dependency()
22+
def test_b(self):
23+
pass

doc/examples/scope_session_mod_02.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# test_mod_02.py
2+
3+
import pytest
4+
5+
@pytest.mark.dependency()
6+
@pytest.mark.xfail(reason="deliberate fail")
7+
def test_a():
8+
assert False
9+
10+
@pytest.mark.dependency(
11+
depends=["tests/test_mod_01.py::test_a", "tests/test_mod_01.py::test_c"],
12+
scope='session'
13+
)
14+
def test_e():
15+
pass
16+
17+
@pytest.mark.dependency(
18+
depends=["tests/test_mod_01.py::test_b", "tests/test_mod_02.py::test_e"],
19+
scope='session'
20+
)
21+
def test_f():
22+
pass
23+
24+
@pytest.mark.dependency(
25+
depends=["tests/test_mod_01.py::TestClass::test_b"],
26+
scope='session'
27+
)
28+
def test_g():
29+
pass

doc/examples/testclass.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ class TestClassNamed(object):
3232
def test_a(self):
3333
assert False
3434

35-
@pytest.mark.dependency(name="b", depends=["a"])
35+
@pytest.mark.dependency(name="b")
3636
def test_b(self):
3737
pass
3838

39-
@pytest.mark.dependency(name="c")
39+
@pytest.mark.dependency(name="c", depends=["a"])
4040
def test_c(self):
4141
pass
4242

43-
@pytest.mark.dependency(name="d", depends=["c"])
43+
@pytest.mark.dependency(name="d", depends=["b"])
4444
def test_d(self):
4545
pass
4646

0 commit comments

Comments
 (0)