[Pytest-commit] commit/pytest: 5 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Mon Feb 9 17:33:42 CET 2015
5 new commits in pytest:
https://bitbucket.org/hpk42/pytest/commits/c6f91e74a2a2/
Changeset: c6f91e74a2a2
Branch: env-addopts
User: Dave Hunt
Date: 2015-01-23 20:09:42+00:00
Summary: Support setting configuration using the PYTEST_ADDOPTS environment variable.
Affected #: 2 files
diff -r fa62c5c63c2fb5870852676d8d8899b9656214fd -r c6f91e74a2a22161f616f604a8fa41684ecfedb8 _pytest/config.py
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -705,6 +705,8 @@
def _preparse(self, args, addopts=True):
self._initini(args)
if addopts:
+ env_addopts = os.environ.get('PYTEST_ADDOPTS', '')
+ args[:] = env_addopts.replace('"', '').split() + args
args[:] = self.getini("addopts") + args
self._checkversion()
self.pluginmanager.consider_preparse(args)
diff -r fa62c5c63c2fb5870852676d8d8899b9656214fd -r c6f91e74a2a22161f616f604a8fa41684ecfedb8 testing/test_config.py
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -1,3 +1,5 @@
+import os
+
import py, pytest
from _pytest.config import getcfg
@@ -19,11 +21,16 @@
getcfg([''], ['setup.cfg']) #happens on py.test ""
def test_append_parse_args(self, testdir, tmpdir):
+ os.environ['PYTEST_ADDOPTS'] = '--color no -rs --tb="short"'
tmpdir.join("setup.cfg").write(py.code.Source("""
[pytest]
addopts = --verbose
"""))
config = testdir.parseconfig(tmpdir)
+ del os.environ['PYTEST_ADDOPTS']
+ assert config.option.color == 'no'
+ assert config.option.reportchars == 's'
+ assert config.option.tbstyle == 'short'
assert config.option.verbose
#config = testdir.Config()
#args = [tmpdir,]
https://bitbucket.org/hpk42/pytest/commits/2d4fcdd3609d/
Changeset: 2d4fcdd3609d
Branch: env-addopts
User: Dave Hunt
Date: 2015-01-26 10:39:21+00:00
Summary: Use shlex to split the arguments from PYTEST_ADDOPTS.
Affected #: 1 file
diff -r c6f91e74a2a22161f616f604a8fa41684ecfedb8 -r 2d4fcdd3609d648d6eef5d0741b305c0ac2b4cee _pytest/config.py
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -705,8 +705,7 @@
def _preparse(self, args, addopts=True):
self._initini(args)
if addopts:
- env_addopts = os.environ.get('PYTEST_ADDOPTS', '')
- args[:] = env_addopts.replace('"', '').split() + args
+ args[:] = shlex.split(os.environ.get('PYTEST_ADDOPTS', '')) + args
args[:] = self.getini("addopts") + args
self._checkversion()
self.pluginmanager.consider_preparse(args)
https://bitbucket.org/hpk42/pytest/commits/e98f9c9e703e/
Changeset: e98f9c9e703e
Branch: env-addopts
User: Dave Hunt
Date: 2015-01-29 10:52:01+00:00
Summary: Use monkeypatch to set the PYTEST_ADDOPTS environment variable in the test.
Affected #: 1 file
diff -r 2d4fcdd3609d648d6eef5d0741b305c0ac2b4cee -r e98f9c9e703ead8a39feaa2b2ace0e892d293bfd testing/test_config.py
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -1,5 +1,3 @@
-import os
-
import py, pytest
from _pytest.config import getcfg
@@ -20,14 +18,13 @@
def test_getcfg_empty_path(self, tmpdir):
getcfg([''], ['setup.cfg']) #happens on py.test ""
- def test_append_parse_args(self, testdir, tmpdir):
- os.environ['PYTEST_ADDOPTS'] = '--color no -rs --tb="short"'
+ def test_append_parse_args(self, testdir, tmpdir, monkeypatch):
+ monkeypatch.setenv('PYTEST_ADDOPTS', '--color no -rs --tb="short"')
tmpdir.join("setup.cfg").write(py.code.Source("""
[pytest]
addopts = --verbose
"""))
config = testdir.parseconfig(tmpdir)
- del os.environ['PYTEST_ADDOPTS']
assert config.option.color == 'no'
assert config.option.reportchars == 's'
assert config.option.tbstyle == 'short'
https://bitbucket.org/hpk42/pytest/commits/71fc066403d2/
Changeset: 71fc066403d2
Branch: env-addopts
User: Dave Hunt
Date: 2015-02-09 14:11:54+00:00
Summary: Added documentation for PYTEST_ADDOPTS environment variable, updated CHANGELOG and AUTHORS.
Affected #: 3 files
diff -r e98f9c9e703ead8a39feaa2b2ace0e892d293bfd -r 71fc066403d29c44ae087a4c9988370b162e2167 AUTHORS
--- a/AUTHORS
+++ b/AUTHORS
@@ -46,3 +46,4 @@
David Mohr
Nicolas Delaby
Tom Viner
+Dave Hunt
diff -r e98f9c9e703ead8a39feaa2b2ace0e892d293bfd -r 71fc066403d29c44ae087a4c9988370b162e2167 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
2.7.0.dev (compared to 2.6.4)
-----------------------------
+- add ability to set command line options by environment variable PYTEST_ADDOPTS.
+
- fix issue655: work around different ways that cause python2/3
to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
diff -r e98f9c9e703ead8a39feaa2b2ace0e892d293bfd -r 71fc066403d29c44ae087a4c9988370b162e2167 doc/en/customize.txt
--- a/doc/en/customize.txt
+++ b/doc/en/customize.txt
@@ -60,6 +60,11 @@
[pytest]
addopts = -rsxX -q
+Alternatively, you can set a PYTEST_ADDOPTS environment variable to add command
+line options while the environment is in use::
+
+ export PYTEST_ADDOPTS="-rsxX -q"
+
From now on, running ``pytest`` will add the specified options.
Builtin configuration file options
https://bitbucket.org/hpk42/pytest/commits/46d5ac0ba396/
Changeset: 46d5ac0ba396
User: flub
Date: 2015-02-09 16:33:36+00:00
Summary: Merged in davehunt/pytest/env-addopts (pull request #241)
Support setting configuration using the PYTEST_ADDOPTS environment variable
Affected #: 5 files
diff -r a7d80ee0a5a24bd0c9f9d3b3997f0a7f5bc10189 -r 46d5ac0ba396af887969a3cc9940fccba5ff1955 AUTHORS
--- a/AUTHORS
+++ b/AUTHORS
@@ -46,3 +46,4 @@
David Mohr
Nicolas Delaby
Tom Viner
+Dave Hunt
diff -r a7d80ee0a5a24bd0c9f9d3b3997f0a7f5bc10189 -r 46d5ac0ba396af887969a3cc9940fccba5ff1955 CHANGELOG
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
2.7.0.dev (compared to 2.6.4)
-----------------------------
+- add ability to set command line options by environment variable PYTEST_ADDOPTS.
+
- fix issue655: work around different ways that cause python2/3
to leak sys.exc_info into fixtures/tests causing failures in 3rd party code
diff -r a7d80ee0a5a24bd0c9f9d3b3997f0a7f5bc10189 -r 46d5ac0ba396af887969a3cc9940fccba5ff1955 _pytest/config.py
--- a/_pytest/config.py
+++ b/_pytest/config.py
@@ -705,6 +705,7 @@
def _preparse(self, args, addopts=True):
self._initini(args)
if addopts:
+ args[:] = shlex.split(os.environ.get('PYTEST_ADDOPTS', '')) + args
args[:] = self.getini("addopts") + args
self._checkversion()
self.pluginmanager.consider_preparse(args)
diff -r a7d80ee0a5a24bd0c9f9d3b3997f0a7f5bc10189 -r 46d5ac0ba396af887969a3cc9940fccba5ff1955 doc/en/customize.txt
--- a/doc/en/customize.txt
+++ b/doc/en/customize.txt
@@ -60,6 +60,11 @@
[pytest]
addopts = -rsxX -q
+Alternatively, you can set a PYTEST_ADDOPTS environment variable to add command
+line options while the environment is in use::
+
+ export PYTEST_ADDOPTS="-rsxX -q"
+
From now on, running ``pytest`` will add the specified options.
Builtin configuration file options
diff -r a7d80ee0a5a24bd0c9f9d3b3997f0a7f5bc10189 -r 46d5ac0ba396af887969a3cc9940fccba5ff1955 testing/test_config.py
--- a/testing/test_config.py
+++ b/testing/test_config.py
@@ -18,12 +18,16 @@
def test_getcfg_empty_path(self, tmpdir):
getcfg([''], ['setup.cfg']) #happens on py.test ""
- def test_append_parse_args(self, testdir, tmpdir):
+ def test_append_parse_args(self, testdir, tmpdir, monkeypatch):
+ monkeypatch.setenv('PYTEST_ADDOPTS', '--color no -rs --tb="short"')
tmpdir.join("setup.cfg").write(py.code.Source("""
[pytest]
addopts = --verbose
"""))
config = testdir.parseconfig(tmpdir)
+ assert config.option.color == 'no'
+ assert config.option.reportchars == 's'
+ assert config.option.tbstyle == 'short'
assert config.option.verbose
#config = testdir.Config()
#args = [tmpdir,]
Repository URL: https://bitbucket.org/hpk42/pytest/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the pytest-commit
mailing list