Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
usadelndsoc
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JYU Condensed Matter Theory
usadelndsoc
Commits
105ee684
Commit
105ee684
authored
2 years ago
by
patavirt
Browse files
Options
Downloads
Patches
Plain Diff
Fixup test framework
parent
2370a108
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
pyproject.toml
+5
-0
5 additions, 0 deletions
pyproject.toml
tests/conftest.py
+25
-0
25 additions, 0 deletions
tests/conftest.py
tests/test_basic.py
+3
-1
3 additions, 1 deletion
tests/test_basic.py
with
33 additions
and
1 deletion
pyproject.toml
+
5
−
0
View file @
105ee684
...
...
@@ -31,3 +31,8 @@ dependencies = [
test
=
[
'pytest >= 3'
]
[tool.pytest.ini_options]
filterwarnings
=
[
'ignore:the imp module is deprecated:DeprecationWarning'
]
This diff is collapsed.
Click to expand it.
tests/conftest.py
0 → 100644
+
25
−
0
View file @
105ee684
# -*- coding:utf-8; eval: (blacken-mode) -*-
import
os
import
pytest
def
pytest_configure
(
config
):
config
.
addinivalue_line
(
"
markers
"
,
"
slow: mark test as slow to run
"
)
def
pytest_addoption
(
parser
):
parser
.
addoption
(
"
--slow
"
,
action
=
"
store_true
"
,
dest
=
"
slow
"
,
default
=
False
,
help
=
"
enable slow tests
"
,
)
def
pytest_collection_modifyitems
(
config
,
items
):
if
not
config
.
getoption
(
"
--slow
"
):
skip_slow
=
pytest
.
mark
.
skip
(
reason
=
"
need --slow option to run
"
)
for
item
in
items
:
if
item
.
get_closest_marker
(
"
slow
"
):
item
.
add_marker
(
skip_slow
)
This diff is collapsed.
Click to expand it.
tests/test_basic.py
+
3
−
1
View file @
105ee684
# -*- eval: (blacken-mode) -*-
import
logging
import
pytest
import
numpy
as
np
from
numpy.testing
import
assert_allclose
...
...
@@ -31,9 +32,10 @@ def basic_setup(terminals=False, nx=15, ny=5):
# s.solve(omega=150, maxiter=300, preconditioner="none")
@pytest.mark.slow
def
test_solve_dos
():
s
=
basic_setup
()
E
=
np
.
linspace
(
-
3
,
3
,
101
)
+
0.0
01
j
E
=
np
.
linspace
(
-
3
,
3
,
101
)
+
0.0
5
j
res
=
s
.
solve_many
(
omega
=-
1j
*
E
)
g
=
res
.
G
[:,
10
,
2
,
0
,
0
]
g_an
=
-
1j
*
E
/
np
.
sqrt
(
1
-
E
**
2
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment