summaryrefslogtreecommitdiff
path: root/ptr.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2012-09-07 16:29:25 -0400
committerJason R. Coombs <jaraco@jaraco.com>2012-09-07 16:29:25 -0400
commitde551c6cf7e79e7f8b4c7948302d4549cc2245c2 (patch)
tree9c8d12e48a8cc6ca25a5048e1065670f06905755 /ptr.py
parent142f49d4c413f62f25f04b4bb0703c7a01bf0dfa (diff)
downloadpytest-runner-de551c6cf7e79e7f8b4c7948302d4549cc2245c2.tar.gz
Added support for --addopts to ptr command1.1b1
Diffstat (limited to 'ptr.py')
-rw-r--r--ptr.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/ptr.py b/ptr.py
index 5f70a03..4cea126 100644
--- a/ptr.py
+++ b/ptr.py
@@ -3,6 +3,8 @@ Implementation
"""
import os as _os
+import shlex as _shlex
+import warnings as _warnings
import setuptools.command.test as _pytest_runner_test
@@ -15,6 +17,8 @@ class PyTest(_pytest_runner_test.test):
"dependencies"),
('allow-hosts=', None, "Whitelist of comma-separated hosts to allow "
"when retrieving dependencies"),
+ ('addopts=', None, "Additional options to be passed verbatim to the "
+ "pytest runner")
]
def initialize_options(self):
@@ -22,9 +26,17 @@ class PyTest(_pytest_runner_test.test):
self.extras = False
self.index_url = None
self.allow_hosts = None
+ self.addopts = []
def finalize_options(self):
- pass
+ if self.addopts:
+ self.addopts = _shlex.split(self.addopts)
+ if self.junitxml:
+ # For compatibility, allow junitxml to be provided to the plugin.
+ # In the future, junitxml should be specified using addopts.
+ _warnings.warn("junitxml is deprecated, use addopts to pass "
+ "options to py.test", DeprecationWarning)
+ self.addopts.extend(['--junitxml', self.junitxml])
def run(self):
"""
@@ -86,9 +98,7 @@ class PyTest(_pytest_runner_test.test):
import sys
# hide command-line arguments from pytest.main
argv_saved = list(sys.argv)
- del sys.argv[1:]
- if getattr(self, 'junitxml', None):
- sys.argv.append('--junitxml=%s' % self.junitxml)
+ sys.argv[1:] = self.addopts
self.result_code = pytest.main()
sys.argv[:] = argv_saved