mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Absolutely no unicode in os.environ
This commit is contained in:
parent
3adb8a2bb4
commit
a82c0626cd
1 changed files with 13 additions and 9 deletions
|
@ -29,13 +29,6 @@ if CODE_DIR in sys.path:
|
|||
sys.path.remove(CODE_DIR)
|
||||
sys.path.insert(0, CODE_DIR)
|
||||
|
||||
# Coverage
|
||||
COVERAGERC_FILE = os.path.join(CODE_DIR, '.coveragerc')
|
||||
MAYBE_RUN_COVERAGE = sys.argv[0].endswith('pytest.py') or '_COVERAGE_RCFILE' in os.environ
|
||||
if MAYBE_RUN_COVERAGE:
|
||||
# Flag coverage to track suprocesses by pointing it to the right .coveragerc file
|
||||
os.environ['COVERAGE_PROCESS_START'] = COVERAGERC_FILE
|
||||
|
||||
# Import test libs
|
||||
from tests.support.runtests import RUNTIME_VARS
|
||||
|
||||
|
@ -60,6 +53,17 @@ from salt.utils.immutabletypes import freeze
|
|||
# Import Pytest Salt libs
|
||||
from pytestsalt.utils import cli_scripts
|
||||
|
||||
# Coverage
|
||||
if 'COVERAGE_PROCESS_START' in os.environ:
|
||||
MAYBE_RUN_COVERAGE = True
|
||||
COVERAGERC_FILE = os.environ['COVERAGE_PROCESS_START']
|
||||
else:
|
||||
COVERAGERC_FILE = os.path.join(CODE_DIR, '.coveragerc')
|
||||
MAYBE_RUN_COVERAGE = sys.argv[0].endswith('pytest.py') or '_COVERAGE_RCFILE' in os.environ
|
||||
if MAYBE_RUN_COVERAGE:
|
||||
# Flag coverage to track suprocesses by pointing it to the right .coveragerc file
|
||||
os.environ[str('COVERAGE_PROCESS_START')] = str(COVERAGERC_FILE)
|
||||
|
||||
# Define the pytest plugins we rely on
|
||||
pytest_plugins = ['tempdir', 'helpers_namespace', 'salt-runtests-bridge'] # pylint: disable=invalid-name
|
||||
|
||||
|
@ -328,13 +332,13 @@ def pytest_runtest_setup(item):
|
|||
if destructive_tests_marker is not None or _has_unittest_attr(item, '__destructive_test__'):
|
||||
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'))
|
||||
os.environ[str('DESTRUCTIVE_TESTS')] = str(item.config.getoption('--run-destructive'))
|
||||
|
||||
expensive_tests_marker = item.get_closest_marker('expensive_test')
|
||||
if expensive_tests_marker is not None or _has_unittest_attr(item, '__expensive_test__'):
|
||||
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'))
|
||||
os.environ[str('EXPENSIVE_TESTS')] = str(item.config.getoption('--run-expensive'))
|
||||
|
||||
skip_if_not_root_marker = item.get_closest_marker('skip_if_not_root')
|
||||
if skip_if_not_root_marker is not None or _has_unittest_attr(item, '__skip_if_not_root__'):
|
||||
|
|
Loading…
Add table
Reference in a new issue