Merge pull request #47968 from gtmanfred/2017.7

Clean up tox + pytest
This commit is contained in:
Nicole Thomas 2018-06-06 17:23:51 -04:00 committed by GitHub
commit 0dcaead36d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 50 additions and 20 deletions

View file

@ -5,6 +5,7 @@ msgpack>=0.5,!=0.5.5
PyYAML
MarkupSafe
requests>=1.0.0
tornado>=4.2.1,<6.0
tornado>=4.2.1,<6.0; python_version < '3'
tornado>=4.2.1,<5.0; python_version >= '3.4'
# Required by Tornado to handle threads stuff.
futures>=2.0; python_version < '3.0'

View file

@ -1,10 +1,6 @@
-r base.txt
mock>=2.0.0
apache-libcloud>=0.14.0
boto>=2.32.1
boto3>=1.2.1
moto>=0.3.6
SaltPyLint>=v2017.3.6
pytest>=3.5.0
git+https://github.com/saltstack/pytest-salt.git@master#egg=pytest-salt

36
requirements/tests.txt Normal file
View file

@ -0,0 +1,36 @@
-r zeromq.txt
-r dev.txt
-r pytest.txt
apache-libcloud>=1.0.0
boto>=2.32.1
boto3>=1.2.1
moto>=0.3.6
docker; sys.platform != 'win32'
docker==2.7.0; sys.platform == 'win32'
virtualenv
setuptools>=30
six>=1.10.0
timelib
coverage
keyring==5.7.1
python-gnupg
python-etcd==0.4.2
GitPython
supervisor; python_version < '3'
kubernetes<4.0
psutil
pyvmomi
setproctitle
cherrypy; sys.platform != 'win32' and sys.platform != 'darwin'
pyinotify; sys.platform != 'win32' and sys.platform != 'darwin'
PyMySQL; sys.platform != 'win32' and sys.platform != 'darwin'
jsonschema
strict_rfc3339
rfc3987
jinja2
pyOpenSSL
ioflo
dnspython
SaltTesting==2017.6.1
junos-eznc
jxmlease

View file

@ -253,11 +253,13 @@ def pytest_runtest_setup(item):
if destructive_tests_marker is not None:
if item.config.getoption('--run-destructive') is False:
pytest.skip('Destructive tests are disabled')
os.environ['DESTRUCTIVE_TESTS'] = six.text_type(item.config.getoption('--run-destructive'))
expensive_tests_marker = item.get_marker('expensive_test')
if expensive_tests_marker is not None:
if item.config.getoption('--run-expensive') is False:
pytest.skip('Expensive tests are disabled')
os.environ['EXPENSIVE_TESTS'] = six.text_type(item.config.getoption('--run-expensive'))
skip_if_not_root_marker = item.get_marker('skip_if_not_root')
if skip_if_not_root_marker is not None:

View file

@ -2,12 +2,14 @@
# Import Python libs
from __future__ import absolute_import
import os
# Import Salt libs
import salt.config
import salt.daemons.masterapi as masterapi
# Import Salt Testing Libs
from tests.support.paths import TMP_CONF_DIR
from tests.support.unit import TestCase
from tests.support.mock import (
patch,
@ -33,7 +35,7 @@ class RemoteFuncsTestCase(TestCase):
'''
def setUp(self):
opts = salt.config.master_config(None)
opts = salt.config.master_config(os.path.join(TMP_CONF_DIR, 'master'))
self.funcs = masterapi.RemoteFuncs(opts)
self.funcs.cache = FakeCache()

View file

@ -59,9 +59,11 @@ class DocTestCase(TestCase):
key, val = regex.split(line, 1)
# Don't test man pages, this file,
# the page that documents to not use ":doc:", or
# the doc/conf.py file
# the tox virtualenv files, the page
# that documents to not use ":doc:",
# or the doc/conf.py file
if 'man' in key \
or '.tox/' in key \
or key.endswith('test_doc.py') \
or key.endswith(os.sep.join(['doc', 'conf.py'])) \
or key.endswith(os.sep.join(['conventions', 'documentation.rst'])) \

15
tox.ini
View file

@ -2,15 +2,6 @@
envlist = py27,py34,py35,py36
[testenv]
sitepackages = True
deps =
py27,pylint: -r{toxinidir}/requirements/dev_python27.txt
py34,py35,py36: -r{toxinidir}/requirements/dev_python34.txt
commands =
py27: python2 {toxinidir}/tests/runtests.py {posargs:-v --run-destructive}
py34,py35,py36: python3 {toxinidir}/tests/runtests.py {posargs:-v --run-destructive}
[testenv:pylint]
basepython = python2.7
commands = pylint --rcfile={toxinidir}/.testing.pylintrc --disable=W1307 {posargs:setup.py salt/}
pylint --rcfile={toxinidir}/.testing.pylintrc --disable=W0232,E1002,W1307 {posargs:tests/}
deps = -r{toxinidir}/requirements/tests.txt
commands = pytest --rootdir {toxinidir} {posargs:--no-print-logs --run-destructive}
passenv = LANG HOME