Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MLAir
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
esde
machine-learning
MLAir
Commits
e14f3474
Commit
e14f3474
authored
5 years ago
by
lukas leufen
Browse files
Options
Downloads
Patches
Plain Diff
modified pytest_runtest_teardown
parent
7c8918ca
No related branches found
No related tags found
2 merge requests
!24
include recent development
,
!20
not distributed training
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
conftest.py
+9
-34
9 additions, 34 deletions
conftest.py
with
9 additions
and
34 deletions
conftest.py
+
9
−
34
View file @
e14f3474
import
os
import
shutil
import
py
import
pytest
@pytest.fixture
(
scope
=
'
class
'
)
def
teardown_module
(
pytestconfig
):
yield
# dirname can be found at pytestconfig._assertstate.hook.session._initialparts[0][0].dirname but it is not clear for
# me, if there can be more than 1 entry in each of the lists. Therefore just loop over all elements will definitely
# catch all dirnames.
d
=
pytestconfig
.
_assertstate
.
hook
.
session
.
_initialparts
f
=
open
(
"
testfile.log
"
,
"
a+
"
)
print
(
f
"
pytestconfig._assertstate.hook.session._initialparts
{
pytestconfig
.
_assertstate
.
hook
.
session
.
_initialparts
}
"
)
print
(
f
"
pytestconfig._assertstate.hook.session._initialpaths
{
pytestconfig
.
_assertstate
.
hook
.
session
.
_initialpaths
}
"
)
f
.
write
(
f
"
pytestconfig._assertstate.hook.session._initialparts
{
pytestconfig
.
_assertstate
.
hook
.
session
.
_initialparts
}
\n
"
)
f
.
write
(
f
"
pytestconfig._assertstate.hook.session._initialpaths
{
pytestconfig
.
_assertstate
.
hook
.
session
.
_initialpaths
}
\n
"
)
f
.
write
(
f
"
pytestconfig.invocation_params.dir
{
pytestconfig
.
invocation_params
.
dir
}
\n
"
)
f
.
write
(
f
"
pytestconfig.invocation_dir
{
pytestconfig
.
invocation_dir
}
\n
"
)
f
.
write
(
f
"
list(pytestconfig._assertstate.hook.session._bestrelpathcache.keys())[0].dirname
{
list
(
pytestconfig
.
_assertstate
.
hook
.
session
.
_bestrelpathcache
.
keys
())[
0
].
dirname
}
\n
"
)
f
.
write
(
f
"
list(pytestconfig._assertstate.hook.session._bestrelpathcache.keys())[0].strpath
{
list
(
pytestconfig
.
_assertstate
.
hook
.
session
.
_bestrelpathcache
.
keys
())[
0
].
strpath
}
\n
"
)
for
di
in
d
:
print
(
f
"
di:
{
type
(
di
)
}
:
{
di
}
"
)
for
dii
in
di
:
print
(
f
"
dii:
{
type
(
dii
)
}
:
{
dii
}
"
)
f
.
write
(
f
"
di:
{
type
(
di
)
}
:
{
di
}
\n
"
)
f
.
write
(
f
"
\t
dii:
{
type
(
dii
)
}
:
{
dii
}
\n
"
)
if
isinstance
(
dii
,
py
.
_path
.
local
.
LocalPath
):
print
(
"
is localpath
"
)
f
.
write
(
f
"
\t\t
{
os
.
listdir
(
dii
.
strpath
)
}
\n
"
)
if
"
data
"
in
os
.
listdir
(
dii
.
strpath
):
def
pytest_runtest_teardown
(
item
,
nextitem
):
if
nextitem
is
None
or
item
.
cls
!=
nextitem
.
cls
:
print
(
f
"
\n
new class:
{
item
.
cls
}
->
{
nextitem
.
cls
if
nextitem
else
None
}
"
)
print
(
f
"
\n
{
nextitem
.
fspath
.
dirname
}
"
)
if
"
data
"
in
os
.
listdir
(
item
.
fspath
.
dirname
):
print
(
"
found data
"
)
f
.
write
(
f
"
\t\t
found data
\n
"
)
shutil
.
rmtree
(
os
.
path
.
join
(
dii
.
strpath
,
"
data
"
),
ignore_errors
=
True
)
f
.
write
(
"
#############
\n\n
"
)
f
.
close
()
shutil
.
rmtree
(
os
.
path
.
join
(
item
.
fspath
.
dirname
,
"
data
"
),
ignore_errors
=
True
)
else
:
print
(
f
"
\n
same class:
{
item
.
cls
}
==
{
nextitem
.
cls
}
"
)
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