-
Notifications
You must be signed in to change notification settings - Fork 34
/
conftest.py
57 lines (50 loc) · 2.05 KB
/
conftest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import platform
import sys
is_pypy = 'PyPy' in sys.version
is_x86_or_x86_64 = platform.machine().lower() in ('i386', 'i686', 'x86', 'x86_64', 'amd64')
def pytest_ignore_collect(path):
path = str(path)
if 'manual_runner' in path or 'make_test_stubs' in path or 'plot' in path or 'prerelease' in path:
return True
if 'conf.py' in path:
return True
ver_tup = platform.python_version_tuple()[0:2]
ver_tup = tuple(int(i) for i in ver_tup)
if ver_tup < (3, 7) or ver_tup >= (3, 13) or is_pypy or not is_x86_or_x86_64:
# numba does not yet run under pypy
if 'numba' in path:
return True
if '.rst' in path: # skip .rst tests as different rendering from pint and no support for NUMBER flag
return True
if sys.version[0] == '2':
if 'numba' in path or 'typing_utils' in path:
return True
if 'test' not in path:
return True
if 'ipynb' in path and 'bench' in path:
return True
return False
#def pytest_addoption(parser, pluginmanager):
# if sys.version[0] == '323523':
# parser.addoption("--doctest-modules")
# parser.addini(name="doctest_optionflags", help="", default="NORMALIZE_WHITESPACE NUMBER")
#def pytest_configure(config):
# print(config)
#open('/home/caleb/testoutput', 'w').write(str(1))
#if sys.version[0] == '2':
# args = []
# #print(args)
def pytest_load_initial_conftests(args):
a = 1
b = 2
def pytest_configure(config):
if sys.version[0] == '3':
import pytest
if pytest.__version__.split('.')[0] >= '6':
config.addinivalue_line("addopts", '--doctest-modules')
config.option.doctestmodules = True
config.addinivalue_line("doctest_optionflags", "NUMBER")
# config.addinivalue_line("addopts", config.inicfg['addopts'].replace('//', '') + ' --doctest-modules')
#config.inicfg['addopts'] = config.inicfg['addopts'] + ' --doctest-modules'
#
config.addinivalue_line("doctest_optionflags", "NORMALIZE_WHITESPACE")