FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
stumpy/conftest.py at main · stumpy-dev/stumpy · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
stumpy-dev
/
stumpy
Public
Notifications
You must be signed in to change notification settings
Fork
367
Star
4.1k
Code
Issues
66
Pull requests
11
Discussions
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
stumpy
/
conftest.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
91 lines (75 loc) · 2.29 KB
Breadcrumbs
stumpy
/
conftest.py
Copy path
File metadata and controls
91 lines (75 loc) · 2.29 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# This file acts as an entry point for pytest.
# Its root directory is added to `sys.path` when pytest is executed
# to fix eventual module import errors that can arise, for example when
# running tests from inside VS code.
# See https://stackoverflow.com/a/34520971
import
os
import
platform
from
importlib
.
metadata
import
PackageNotFoundError
,
version
import
pytest
from
stumpy
import
rng
def
get_specs
():
"""
Find and return all package versions
"""
pkgs
=
[
# Alphabetical Order
"black"
,
"coverage"
,
"dask"
,
"distributed"
,
"flake8"
,
"isort"
,
"numba"
,
"numpy"
,
"pandas"
,
"polars"
,
"python"
,
"pytest"
,
"ray"
,
"scipy"
,
]
specs
=
[]
for
pkg
in
pkgs
:
try
:
# pragma: no cover
pkg_version
=
version
(
pkg
)
# specs.append(f"--spec {pkg}={pkg_version}")
specs
.
append
(
f"--with
{
pkg
}
==
{
pkg_version
}
"
)
except
PackageNotFoundError
:
if
pkg
==
"python"
:
# specs.append(f"--spec {pkg}={platform.python_version()}")
specs
.
append
(
f"--python
{
pkg
}
==
{
platform
.
python_version
()
}
"
)
pass
return
" "
.
join
(
specs
)
def
get_env_vars
():
"""
Find and return all environment variables
"""
keys
=
[
"NUMBA_DISABLE_JIT"
,
"NUMBA_ENABLE_CUDASIM"
,
]
env_vars
=
[]
for
key
in
keys
:
value
=
os
.
getenv
(
key
)
if
value
is
not
None
:
env_vars
.
append
(
f"
{
key
}
=
{
value
}
"
)
return
" "
.
join
(
env_vars
)
def
pytest_configure
(
config
):
"""
Called after command line options have been parsed
and all plugins and initial conftest files been loaded.
"""
# Store details of starting random seed in case of failure
env_vars
=
get_env_vars
()
specs
=
get_specs
()
pytest
.
STUMPY_MSG
=
f"
\n
\n
STUMPY_SEED=
{
rng
.
SEED
}
{
env_vars
}
"
pytest
.
STUMPY_MSG
+=
f"pixi exec uv run
{
specs
}
./test.sh custom 1
{
config
.
args
[
0
]
}
"
def
pytest_sessionfinish
(
session
,
exitstatus
):
"""
Upon test failure, print additional seed and state
for reproducing test failure
"""
# exitstatus 1 or greater usually indicates failures/errors
if
session
.
testsfailed
>
0
:
# pragma: no cover
print
(
f"
{
pytest
.
STUMPY_MSG
}
"
)
Back
|
FazBrowse Home
|
New Git URL