Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Test as a Service
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
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
INS Courses
AutPy
Test as a Service
Commits
5615a529
Commit
5615a529
authored
8 months ago
by
Florian Bruhin
Browse files
Options
Downloads
Patches
Plain Diff
Improve rendering of cell tags
parent
11f99f26
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#359734
failed
8 months ago
Stage: lint
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
run_tests.py
+8
-4
8 additions, 4 deletions
run_tests.py
tests/test_run_tests.py
+7
-6
7 additions, 6 deletions
tests/test_run_tests.py
with
15 additions
and
10 deletions
run_tests.py
+
8
−
4
View file @
5615a529
...
...
@@ -63,6 +63,7 @@ class VeiledResultPlugin:
self
.
exitstatus
:
pytest
.
ExitCode
|
None
=
None
def
_record_cell_tags
(
self
,
report
:
pytest
.
TestReport
)
->
None
:
"""
Collect recorded cell tags from a teardown report.
"""
path
,
_lineno
,
_domaininfo
=
report
.
location
props
=
dict
(
report
.
user_properties
)
...
...
@@ -79,10 +80,13 @@ class VeiledResultPlugin:
def
_exercise_name
(
self
,
path
:
str
)
->
str
:
name
=
pathlib
.
PurePath
(
path
).
stem
.
removeprefix
(
"
test_
"
).
replace
(
"
_
"
,
"
"
)
cell_tags
=
self
.
cell_tags
.
get
(
path
)
if
cell_tags
:
name
+=
f
"
(
{
'
,
'
.
join
(
cell_tags
)
}
)
"
return
name
cell_tags
=
{
tag
.
replace
(
"
-
"
,
"
"
)
for
tag
in
self
.
cell_tags
.
get
(
path
,
[])}
cell_tags
.
discard
(
name
)
if
not
cell_tags
:
return
name
return
f
"
{
name
}
(
{
'
,
'
.
join
(
sorted
(
cell_tags
))
}
)
"
def
pytest_sessionfinish
(
self
,
exitstatus
:
pytest
.
ExitCode
)
->
None
:
self
.
exitstatus
=
exitstatus
...
...
This diff is collapsed.
Click to expand it.
tests/test_run_tests.py
+
7
−
6
View file @
5615a529
...
...
@@ -226,10 +226,11 @@ class TestVeiledResultPlugin:
assert
vrp
.
result
()
==
expected_result
@pytest.mark.parametrize
(
"
tag, tag_s
tr
"
,
"
tag, tag_s
uffix
"
,
[
(
"
single-tag
"
,
"
single-tag
"
),
([
"
multi-tag-1
"
,
"
multi-tag-2
"
],
"
multi-tag-1, multi-tag-2
"
),
(
"
single-tag
"
,
"
(single tag)
"
),
([
"
multi-tag-1
"
,
"
multi-tag-2
"
],
"
(multi tag 1, multi tag 2)
"
),
(
"
cell-tag-property
"
,
""
),
],
)
def
test_cell_tag_property
(
...
...
@@ -237,7 +238,7 @@ class TestVeiledResultPlugin:
pytester
:
pytest
.
Pytester
,
vrp
:
run_tests
.
VeiledResultPlugin
,
tag
:
str
|
list
[
str
],
tag_s
tr
:
str
,
tag_s
uffix
:
str
,
)
->
None
:
pytester
.
makepyfile
(
f
"""
...
...
@@ -257,8 +258,8 @@ class TestVeiledResultPlugin:
assert
res
.
ret
==
pytest
.
ExitCode
.
OK
res
.
assert_outcomes
(
passed
=
1
)
title
=
f
"
cell tag property
(
{
tag_s
tr
}
)
"
assert
vrp
.
result
()[
"
tests
"
].
keys
()
==
{
title
}
title
=
f
"
cell tag property
{
tag_s
uffix
}
"
assert
set
(
vrp
.
result
()[
"
tests
"
].
keys
()
)
==
{
title
}
def
test_cell_tag_property_invalid_type
(
self
,
pytester
:
pytest
.
Pytester
,
vrp
:
run_tests
.
VeiledResultPlugin
...
...
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