Skip to content

Commit bab2346

Browse files
committed
Merge branch 'master' into scope
2 parents d5fa2cb + 7b7c108 commit bab2346

21 files changed

+163
-191
lines changed

.travis.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
language: python
22
python:
33
- "2.7"
4-
- "3.2"
5-
- "3.3"
64
- "3.4"
75
- "3.5"
86
- "3.6"

CHANGES

Lines changed: 0 additions & 98 deletions
This file was deleted.

MANIFEST.in

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
include CHANGES
21
include LICENSE.txt
32
include MANIFEST.in
43
include README.rst
54
include doc/examples/*.py
6-
include python2_6.patch
75
include tests/conftest.py
86
include tests/pytest.ini
97
include tests/test_*.py

Makefile

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

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

1414
doc-html:
1515
$(MAKE) -C doc html
1616

17-
1817
clean:
1918
rm -f *~ tests/*~
2019
rm -rf build
@@ -27,15 +26,11 @@ distclean: clean
2726
rm -rf __pycache__ tests/__pycache__
2827
rm -rf dist
2928
rm -rf pytest_dependency.egg-info
30-
rm -f python2_6.patch
29+
rm -rf .pytest_cache
3130
$(MAKE) -C doc distclean
3231

3332
.gitrevision:
3433
git describe --always --dirty > .gitrevision
3534

36-
python2_6.patch:
37-
git diff `git merge-base master python2_6` python2_6 \
38-
-- . ':(exclude).travis.yml' > $@
39-
4035

4136
.PHONY: build test sdist doc-html clean distclean .gitrevision

README.rst

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@ The latest release version can be found at PyPI, see
2020
System requirements
2121
-------------------
2222

23-
+ Python 2.6, 2.7, or 3.2 and newer.
24-
Python 2.6 requires patching the sources, see below.
23+
+ Python 2.7 or 3.4 and newer.
2524
+ `setuptools`_.
26-
+ `pytest`_ 2.8.0 or newer.
27-
28-
(Python 3.1 is not supported by pytest 2.8.0 itself.)
25+
+ `pytest`_ 3.6.0 or newer.
2926

3027

3128
Installation
@@ -48,16 +45,6 @@ Installation
4845
The last step might require admin privileges in order to write into
4946
the site-packages directory of your Python installation.
5047

51-
If you are using Python 2.6, apply python2_6.patch after the first
52-
step:
53-
54-
1a. Patch::
55-
56-
$ patch -p1 < python2_6.patch
57-
58-
It removes the use of certain language features (dict comprehensions)
59-
that were introduced in Python 2.7.
60-
6148

6249
Documentation
6350
-------------

doc/examples/all_params.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def test_a(x):
2424
def test_b():
2525
pass
2626

27-
params_c = zip(range(0,8,2), range(2,6))
27+
params_c = list(zip(range(0,8,2), range(2,6)))
2828

2929
@pytest.mark.parametrize("x,y", params_c)
3030
@pytest.mark.dependency()

doc/examples/dyn-parametrized.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,14 @@ def __str__(self):
2626
# Create enriched parameter lists, decorated with the dependency marker.
2727

2828
childparam = [
29-
pytest.mark.dependency(name="test_child[%s]" % c)(c) for c in childs
29+
pytest.param(c, marks=pytest.mark.dependency(name="test_child[%s]" % c))
30+
for c in childs
3031
]
3132
parentparam = [
32-
pytest.mark.dependency(
33+
pytest.param(p, marks=pytest.mark.dependency(
3334
name="test_parent[%s]" % p,
3435
depends=["test_child[%s]" % c for c in p.children]
35-
)(p) for p in parents
36+
)) for p in parents
3637
]
3738

3839
@pytest.mark.parametrize("c", childparam)

doc/examples/parametrized.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,39 @@
11
import pytest
22

33
@pytest.mark.parametrize("x,y", [
4-
pytest.mark.dependency(name="a1")((0,0)),
5-
pytest.mark.dependency(name="a2")(pytest.mark.xfail((0,1))),
6-
pytest.mark.dependency(name="a3")((1,0)),
7-
pytest.mark.dependency(name="a4")((1,1))
4+
pytest.param(0, 0, marks=pytest.mark.dependency(name="a1")),
5+
pytest.param(0, 1, marks=[pytest.mark.dependency(name="a2"),
6+
pytest.mark.xfail]),
7+
pytest.param(1, 0, marks=pytest.mark.dependency(name="a3")),
8+
pytest.param(1, 1, marks=pytest.mark.dependency(name="a4"))
89
])
910
def test_a(x,y):
1011
assert y <= x
1112

1213
@pytest.mark.parametrize("u,v", [
13-
pytest.mark.dependency(name="b1", depends=["a1", "a2"])((1,2)),
14-
pytest.mark.dependency(name="b2", depends=["a1", "a3"])((1,3)),
15-
pytest.mark.dependency(name="b3", depends=["a1", "a4"])((1,4)),
16-
pytest.mark.dependency(name="b4", depends=["a2", "a3"])((2,3)),
17-
pytest.mark.dependency(name="b5", depends=["a2", "a4"])((2,4)),
18-
pytest.mark.dependency(name="b6", depends=["a3", "a4"])((3,4))
14+
pytest.param(1, 2, marks=pytest.mark.dependency(name="b1",
15+
depends=["a1", "a2"])),
16+
pytest.param(1, 3, marks=pytest.mark.dependency(name="b2",
17+
depends=["a1", "a3"])),
18+
pytest.param(1, 4, marks=pytest.mark.dependency(name="b3",
19+
depends=["a1", "a4"])),
20+
pytest.param(2, 3, marks=pytest.mark.dependency(name="b4",
21+
depends=["a2", "a3"])),
22+
pytest.param(2, 4, marks=pytest.mark.dependency(name="b5",
23+
depends=["a2", "a4"])),
24+
pytest.param(3, 4, marks=pytest.mark.dependency(name="b6",
25+
depends=["a3", "a4"]))
1926
])
2027
def test_b(u,v):
2128
pass
2229

2330
@pytest.mark.parametrize("w", [
24-
pytest.mark.dependency(name="c1", depends=["b1", "b2", "b6"])(1),
25-
pytest.mark.dependency(name="c2", depends=["b2", "b3", "b6"])(2),
26-
pytest.mark.dependency(name="c3", depends=["b2", "b4", "b6"])(3)
31+
pytest.param(1, marks=pytest.mark.dependency(name="c1",
32+
depends=["b1", "b2", "b6"])),
33+
pytest.param(2, marks=pytest.mark.dependency(name="c2",
34+
depends=["b2", "b3", "b6"])),
35+
pytest.param(3, marks=pytest.mark.dependency(name="c3",
36+
depends=["b2", "b4", "b6"]))
2737
])
2838
def test_c(w):
2939
pass

doc/src/about.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ Copyright and License
7171

7272
- Copyright 2013-2015
7373
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
74-
- Copyright 2016-2017 Rolf Krahl
74+
- Copyright 2016-2018 Rolf Krahl
7575

7676
Licensed under the Apache License, Version 2.0 (the "License"); you
7777
may not use this file except in compliance with the License. You may

doc/src/changelog.rst

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
History of changes to pytest-dependency
2+
=======================================
3+
4+
dev (not yet released)
5+
Bug fixes and minor changes
6+
+ Issue #34: failing test with pytest 4.2.0 and newer.
7+
8+
0.4 (2018-12-02)
9+
Incompatible changes
10+
+ Require pytest version 3.6.0 or newer. This implicitly drops
11+
support for Python 2.6 and for Python 3.3 and older.
12+
13+
Bug fixes and minor changes
14+
+ Issue #24: get_marker no longer available in pytest 4.0.0.
15+
(Thanks to Rogdham for the PR.)
16+
+ Issue #28: Applying markers directly in parametrize is no
17+
longer available in 4.0.
18+
19+
0.3.2 (2018-01-17)
20+
Bug fixes and minor changes
21+
+ Issue #5: properly register the dependency marker.
22+
+ Do not add the documentation to the source distribution.
23+
24+
0.3.1 (2017-12-26)
25+
Bug fixes and minor changes
26+
+ Issue #17: Move the online documentation to Read the Docs
27+
+ Some improvements in the documentation.
28+
29+
0.3 (2017-12-26)
30+
New features
31+
+ Issue #7: Add a configuration switch to implicitly mark all
32+
tests.
33+
+ Issue #10: Add an option to ignore unknown dependencies.
34+
35+
Incompatible changes
36+
+ Prepend the class name to the default test name for test class
37+
methods. This fixes a potential name conflict, see Issue #6.
38+
39+
If your code uses test classes and you reference test methods
40+
by their default name, you must add the class name. E.g. if
41+
you have something like:
42+
43+
.. code-block:: python
44+
45+
class TestClass(object):
46+
47+
@pytest.mark.dependency()
48+
def test_a():
49+
pass
50+
51+
@pytest.mark.dependency(depends=["test_a"])
52+
def test_b():
53+
pass
54+
55+
you need to change this to:
56+
57+
.. code-block:: python
58+
59+
class TestClass(object):
60+
61+
@pytest.mark.dependency()
62+
def test_a():
63+
pass
64+
65+
@pytest.mark.dependency(depends=["TestClass::test_a"])
66+
def test_b():
67+
pass
68+
69+
If you override the test name in the pytest.mark.dependency()
70+
marker, nothing need to be changed.
71+
72+
Bug fixes and minor changes
73+
+ PR #11: show the name of the skipped test (thanks
74+
asteriogonzalez).
75+
+ Issue #13: Do not import pytest in setup.py to make it
76+
compatible with pipenv.
77+
+ Issue #15: tests fail with pytest 3.3.0.
78+
+ Issue #8: document incompatibility with parallelization in
79+
pytest-xdist.
80+
+ Clarify in the documentation that Python 3.1 is not officially
81+
supported because pytest 2.8 does not support it. There is no
82+
known issue with Python 3.1 though.
83+
84+
0.2 (2017-05-28)
85+
New features
86+
+ Issue #2: Add documentation.
87+
+ Issue #4: Add a depend() function to add a dependency to a
88+
test at runtime.
89+
90+
0.1 (2017-01-29)
91+
+ Initial release as an independent Python module.
92+
93+
This code was first developed as part of a larger package,
94+
python-icat, at Helmholtz-Zentrum Berlin für Materialien und
95+
Energie, see
96+
https://icatproject.org/user-documentation/python-icat/

0 commit comments

Comments
 (0)