enable pytester to run examples copied from the cwd
This commit is contained in:
parent
6b239263da
commit
0672bc633f
|
@ -53,6 +53,10 @@ def pytest_addoption(parser):
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.addini(
|
||||||
|
"pytester_example_dir", help="directory to take the pytester example files from"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
if config.getvalue("lsof"):
|
if config.getvalue("lsof"):
|
||||||
|
@ -628,6 +632,11 @@ class Testdir(object):
|
||||||
p.ensure("__init__.py")
|
p.ensure("__init__.py")
|
||||||
return p
|
return p
|
||||||
|
|
||||||
|
def copy_example(self, name):
|
||||||
|
example_dir = self.request.config.getini("pytester_example_dir")
|
||||||
|
example_path = self.request.config.rootdir.join(example_dir, name)
|
||||||
|
example_path.copy(self.tmpdir.join(example_path.basename))
|
||||||
|
|
||||||
Session = Session
|
Session = Session
|
||||||
|
|
||||||
def getnode(self, config, arg):
|
def getnode(self, config, arg):
|
||||||
|
|
2
tox.ini
2
tox.ini
|
@ -204,7 +204,7 @@ filterwarnings =
|
||||||
ignore:.*type argument to addoption.*:DeprecationWarning
|
ignore:.*type argument to addoption.*:DeprecationWarning
|
||||||
# produced by python >=3.5 on execnet (pytest-xdist)
|
# produced by python >=3.5 on execnet (pytest-xdist)
|
||||||
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
|
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
|
||||||
|
pytester_example_dir = testing/example_scripts
|
||||||
[flake8]
|
[flake8]
|
||||||
max-line-length = 120
|
max-line-length = 120
|
||||||
ignore = E203,W503
|
ignore = E203,W503
|
||||||
|
|
Loading…
Reference in New Issue