Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bitia-cli
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
bitia
bitia-cli
Commits
d71a6ba0
Commit
d71a6ba0
authored
2 years ago
by
dilawar
Browse files
Options
Downloads
Patches
Plain Diff
fix (test): almost equal.
parent
1b586eee
No related branches found
No related tags found
1 merge request
!6
Hotfix: fix to assert error post installation
Pipeline
#3793
failed with stages
Stage:
Stage:
in 2 minutes and 9 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_sanity.py
+6
-2
6 additions, 2 deletions
tests/test_sanity.py
with
6 additions
and
2 deletions
tests/test_sanity.py
+
6
−
2
View file @
d71a6ba0
...
@@ -9,13 +9,17 @@ def test_sanity(capsys):
...
@@ -9,13 +9,17 @@ def test_sanity(capsys):
assert
len
(
version
)
>=
3
,
version
assert
len
(
version
)
>=
3
,
version
def
almost_equal
(
s1
,
s2
,
threshold
=
0.9
)
->
bool
:
assert
SequenceMatcher
(
a
=
s1
,
b
=
s2
).
ratio
()
>
threshold
def
test_run_repeat
(
capsys
):
def
test_run_repeat
(
capsys
):
bconfig
.
set_config
(
"
plain
"
,
True
)
bconfig
.
set_config
(
"
plain
"
,
True
)
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
False
)
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
False
)
l1
=
capsys
.
readouterr
().
out
# reset the internal buffer.
l1
=
capsys
.
readouterr
().
out
# reset the internal buffer.
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
False
)
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
False
)
l2
=
capsys
.
readouterr
().
out
l2
=
capsys
.
readouterr
().
out
assert
l1
==
l2
assert
almost_equal
(
l1
,
l2
,
0.95
)
def
test_run_simple
(
capsys
):
def
test_run_simple
(
capsys
):
...
@@ -27,4 +31,4 @@ def test_run_simple(capsys):
...
@@ -27,4 +31,4 @@ def test_run_simple(capsys):
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
True
)
bitia
.
__main__
.
run_user_input
(
"
ls -ltr /
"
,
rerun
=
True
)
captured
=
capsys
.
readouterr
()
captured
=
capsys
.
readouterr
()
l2
=
captured
.
out
l2
=
captured
.
out
assert
SequenceMatcher
(
a
=
l1
,
b
=
l2
).
ratio
()
>
0.88
# sometime its less than 0.9
assert
almost_equal
(
l1
,
l2
,
0.88
)
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