Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
5bf7e0fc
Unverified
Commit
5bf7e0fc
authored
4 years ago
by
Paulus Schoutsen
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
List dir when test fails (#33685)
parent
24840b54
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/components/tts/conftest.py
+18
-0
18 additions, 0 deletions
tests/components/tts/conftest.py
tests/components/tts/test_init.py
+13
-2
13 additions, 2 deletions
tests/components/tts/test_init.py
with
31 additions
and
2 deletions
tests/components/tts/conftest.py
0 → 100644
+
18
−
0
View file @
5bf7e0fc
"""
Conftest for TTS tests.
From http://doc.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures
"""
import
pytest
@pytest.hookimpl
(
tryfirst
=
True
,
hookwrapper
=
True
)
def
pytest_runtest_makereport
(
item
,
call
):
"""
Add test report to node.
"""
# execute all other hooks to obtain the report object
outcome
=
yield
rep
=
outcome
.
get_result
()
# set a report attribute for each phase of a call, which can
# be "setup", "call", "teardown"
setattr
(
item
,
"
rep_
"
+
rep
.
when
,
rep
)
This diff is collapsed.
Click to expand it.
tests/components/tts/test_init.py
+
13
−
2
View file @
5bf7e0fc
...
...
@@ -52,7 +52,7 @@ def mock_init_cache_dir():
@pytest.fixture
def
empty_cache_dir
(
tmp_path
,
mock_init_cache_dir
,
mock_get_cache_files
):
def
empty_cache_dir
(
tmp_path
,
mock_init_cache_dir
,
mock_get_cache_files
,
request
):
"""
Mock the TTS cache dir with empty dir.
"""
mock_init_cache_dir
.
side_effect
=
None
mock_init_cache_dir
.
return_value
=
str
(
tmp_path
)
...
...
@@ -60,7 +60,18 @@ def empty_cache_dir(tmp_path, mock_init_cache_dir, mock_get_cache_files):
# Restore original get cache files behavior, we're working with a real dir.
mock_get_cache_files
.
side_effect
=
_get_cache_files
return
tmp_path
yield
tmp_path
if
request
.
node
.
rep_call
.
passed
:
return
# Print contents of dir if failed
print
(
"
Content of dir for
"
,
request
.
node
.
nodeid
)
for
fil
in
tmp_path
.
iterdir
():
print
(
fil
.
relative_to
(
tmp_path
))
# To show the log.
assert
False
@pytest.fixture
(
autouse
=
True
)
...
...
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