Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs1-24fa
project03
Commits
a7886083
Commit
a7886083
authored
6 months ago
by
Adam Blank
Browse files
Options
Download
Email Patches
Plain Diff
Delete test.py
parent
2705fddb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test.py
+0
-57
test.py
with
0 additions
and
57 deletions
+0
-57
test.py
deleted
100644 → 0
View file @
2705fddb
import
pytest
import
os
from
io
import
StringIO
import
sys
import
re
def
clear
():
"""
Clears the terminal screen.
"""
print
(
"
\033
c"
,
end
=
""
,
flush
=
True
)
clear
()
for
f
in
sorted
(
set
(
os
.
listdir
(
'tests'
))
-
set
([
'__pycache__'
,
'__init__.py'
,
'helpers'
])):
print
(
f
.
split
(
"."
)[
-
1
]
+
" Tests: "
)
for
t
in
sorted
(
set
(
os
.
listdir
(
os
.
path
.
join
(
'tests/'
+
f
)))
-
set
([
'__pycache__'
])):
sys
.
stdout
=
result
=
StringIO
()
code
=
pytest
.
main
([
"-vv"
,
"--color=yes"
,
"--no-header"
,
"--disable-warnings"
,
"-rNs"
,
"-x"
]
+
[
os
.
path
.
join
(
'tests'
,
f
,
t
)],
[
'pytest_clarity'
])
sys
.
stdout
=
sys
.
__stdout__
if
code
==
0
:
print
(
" "
+
"
\x1b
[0m
\x1b
[32mPASSED
\x1b
[0m "
+
t
.
replace
(
".py"
,
""
))
continue
before
=
0
skip
=
0
i
=
0
lines
=
result
.
getvalue
().
splitlines
()[
3
:]
while
i
<
len
(
lines
):
line
=
lines
[
i
].
replace
(
"LHS"
,
"CORRECT"
).
replace
(
"RHS"
,
"YOURS"
).
replace
(
"[pytest-clarity diff shown]"
,
""
)
if
'collecting'
in
line
or
'================'
in
line
or
'!!!!!!!'
in
line
:
i
+=
1
continue
if
'@pytest'
in
line
:
before
=
1
if
line
.
startswith
(
"------"
):
line
=
line
[
4
:
-
4
]
if
line
.
startswith
(
os
.
path
.
join
(
'tests'
,
f
,
t
)):
line
=
line
.
replace
(
os
.
path
.
join
(
'tests'
,
f
,
t
)
+
"::"
,
""
)
if
"PASSED"
not
in
line
:
i
+=
5
if
line
.
startswith
(
'
\x1b
[1m
\x1b
[31mE '
):
before
=
2
if
before
<
1
or
before
>
1
:
print
(
' '
+
line
)
i
+=
1
if
code
!=
0
:
exit
(
1
)
print
()
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help