Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --junit-suite-name CLI option #2273

Closed
wants to merge 38 commits into from
Closed
Changes from 2 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
3d18c9c
'xfail' markers without a condition no longer rely on the underlying …
barneygale Dec 18, 2016
8db9915
Update AUTHORS, CHANGELOG
barneygale Dec 18, 2016
df409a0
Fix CHANGELOG.rst
barneygale Jan 2, 2017
d1c7250
Allow to skip unittests if --pdb active
mbyt Jan 30, 2017
36b6f17
fixing code-style, keep flake8 happy
mbyt Jan 31, 2017
e1c5314
Replace 'raise StopIteration' usages in the code by 'return's in acco…
nicoddemus Feb 1, 2017
da5a3db
Merge pull request #2226 from nicoddemus/raise-stop-iteration
RonnyPfannschmidt Feb 1, 2017
176c680
Merge branch 'master' into allow_skipping_unittests_with_pdb_active
nicoddemus Feb 1, 2017
ad56cd8
extract a _handle_skip method, secure PY2 branch
mbyt Feb 2, 2017
bad2612
Do not asssume `Item.obj` in 'skipping' plugin
vidartf Feb 3, 2017
1a88a91
Update authors/history
vidartf Feb 3, 2017
832c89d
Test for `pytest.mark.xfail` with non-Python Item
vidartf Feb 3, 2017
a4d2a57
Merge pull request #2142 from barneygale/xfail_without_condition_getg…
nicoddemus Feb 3, 2017
ccf9877
Merge pull request #2232 from vidartf/patch-1
nicoddemus Feb 3, 2017
87fb689
Remove an unneeded `except KeyboardInterrupt`
bluetech Feb 7, 2017
3a0a0c2
Ignore errors raised from descriptors when collecting fixtures
bluetech Feb 5, 2017
a4fb971
Merge pull request #2235 from bluetech/dont-execute-properties
nicoddemus Feb 8, 2017
6a097aa
Merge branch 'master' into allow_skipping_unittests_with_pdb_active
nicoddemus Feb 8, 2017
3d9c5cf
Merge pull request #2225 from mbyt/allow_skipping_unittests_with_pdb_…
nicoddemus Feb 8, 2017
9eb1d73
--override-ini now correctly overrides some fundamental options like …
nicoddemus Feb 9, 2017
b536fb7
Mention next training event.
flub Feb 14, 2017
427bf42
Merge pull request #2247 from flub/flub/training
flub Feb 14, 2017
c4d9744
Improve pytest_plugins docs
nicoddemus Feb 15, 2017
231e2f9
Merge pull request #2252 from nicoddemus/fixture-visibility-docs
RonnyPfannschmidt Feb 15, 2017
eeb6603
Python 3.6 invalid escape sequence deprecation fixes
scop Feb 15, 2017
ede4e91
Spelling fixes
scop Feb 15, 2017
8f98ac5
Fix typo in docs "textures" -> "fixtures"
nicoddemus Feb 15, 2017
0a26132
Merge pull request #2241 from nicoddemus/override-python-files
RonnyPfannschmidt Feb 15, 2017
27f12ed
Merge pull request #2254 from scop/py36-escseq
nicoddemus Feb 15, 2017
9c809f5
Merge pull request #2255 from scop/spelling
nicoddemus Feb 15, 2017
58d7f4e
Correct typo
vmuriart Feb 17, 2017
a88017c
Add note documenting #2257
vmuriart Feb 17, 2017
21a09f0
Merge pull request #2261 from vmuriart/doc-report_header
nicoddemus Feb 17, 2017
5fd010c
Simplify travis.yml with tox environment variables
asottile Feb 19, 2017
6680cb9
Merge pull request #2264 from asottile/simplify_travis
nicoddemus Feb 19, 2017
d3a6be4
junitxml: Fix double system-out tags per testcase
KKoukiou Feb 22, 2017
0a89db2
Merge pull request #2271 from KKoukiou/double-tag
RonnyPfannschmidt Feb 22, 2017
9e23f1d
Add '--junit-suite-name' option for JUnit XML reports
dimp-gh Feb 22, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -7,7 +7,8 @@
* Ignore exceptions raised from descriptors (e.g. properties) during Python test collection (`#2234`_).
Thanks to `@bluetech`_.

*
* ``--override-ini`` now correctly overrides some fundamental options like ``python_files`` (`#2238`_).
Thanks `@sirex`_ for the report and `@nicoddemus`_ for the PR.

* Replace ``raise StopIteration`` usages in the code by simple ``returns`` to finish generators, in accordance to `PEP-479`_ (`#2160`_).
Thanks `@tgoodlet`_ for the report and `@nicoddemus`_ for the PR.
@@ -28,12 +29,14 @@

.. _@bluetech: https://github.com/bluetech
.. _@gst: https://github.com/gst
.. _@sirex: https://github.com/sirex
.. _@vidartf: https://github.com/vidartf

.. _#2137: https://github.com/pytest-dev/pytest/issues/2137
.. _#2160: https://github.com/pytest-dev/pytest/issues/2160
.. _#2231: https://github.com/pytest-dev/pytest/issues/2231
.. _#2234: https://github.com/pytest-dev/pytest/issues/2234
.. _#2238: https://github.com/pytest-dev/pytest/issues/2238

.. _PEP-479: https://www.python.org/dev/peps/pep-0479/

19 changes: 10 additions & 9 deletions _pytest/config.py
Original file line number Diff line number Diff line change
@@ -877,6 +877,7 @@ def __init__(self, pluginmanager):
self.trace = self.pluginmanager.trace.root.get("config")
self.hook = self.pluginmanager.hook
self._inicache = {}
self._override_ini = ()
self._opt2dest = {}
self._cleanup = []
self._warn = self.pluginmanager._warn
@@ -977,6 +978,7 @@ def _initini(self, args):
self.invocation_dir = py.path.local()
self._parser.addini('addopts', 'extra command line options', 'args')
self._parser.addini('minversion', 'minimally required pytest version')
self._override_ini = ns.override_ini or ()

def _consider_importhook(self, args, entrypoint_name):
"""Install the PEP 302 import hook if using assertion re-writing.
@@ -1159,15 +1161,14 @@ def _get_override_ini_value(self, name):
# and -o foo1=bar1 -o foo2=bar2 options
# always use the last item if multiple value set for same ini-name,
# e.g. -o foo=bar1 -o foo=bar2 will set foo to bar2
if self.getoption("override_ini", None):
for ini_config_list in self.option.override_ini:
for ini_config in ini_config_list:
try:
(key, user_ini_value) = ini_config.split("=", 1)
except ValueError:
raise UsageError("-o/--override-ini expects option=value style.")
if key == name:
value = user_ini_value
for ini_config_list in self._override_ini:
for ini_config in ini_config_list:
try:
(key, user_ini_value) = ini_config.split("=", 1)
except ValueError:
raise UsageError("-o/--override-ini expects option=value style.")
if key == name:
value = user_ini_value
return value

def getoption(self, name, default=notset, skip=False):
15 changes: 15 additions & 0 deletions testing/test_config.py
Original file line number Diff line number Diff line change
@@ -778,6 +778,21 @@ def test_override_ini_usage_error_bad_style(self, testdir):
result = testdir.runpytest("--override-ini", 'xdist_strict True', "-s")
result.stderr.fnmatch_lines(["*ERROR* *expects option=value*"])

@pytest.mark.parametrize('with_ini', [True, False])
def test_override_ini_handled_asap(self, testdir, with_ini):
"""-o should be handled as soon as possible and always override what's in ini files (#2238)"""
if with_ini:
testdir.makeini("""
[pytest]
python_files=test_*.py
""")
testdir.makepyfile(unittest_ini_handle="""
def test():
pass
""")
result = testdir.runpytest("--override-ini", 'python_files=unittest_*.py')
result.stdout.fnmatch_lines(["*1 passed in*"])

def test_with_arg_outside_cwd_without_inifile(self, tmpdir, monkeypatch):
monkeypatch.chdir(str(tmpdir))
a = tmpdir.mkdir("a")