Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
soitool
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
bachelor-paa-bittet
soitool
Commits
f593b7bb
Commit
f593b7bb
authored
5 years ago
by
Thomas Holene Løkkeborg
Browse files
Options
Downloads
Patches
Plain Diff
#112 øker delta i alle tester & parameteriserer delta
parent
7edf7257
No related branches found
Branches containing commit
No related tags found
1 merge request
!63
#112 øker delta på QTimer test
Pipeline
#80590
failed
5 years ago
Stage: lint
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_database.py
+4
-2
4 additions, 2 deletions
test/test_database.py
with
4 additions
and
2 deletions
test/test_database.py
+
4
−
2
View file @
f593b7bb
...
@@ -17,6 +17,8 @@ TESTDBPATH = os.path.join(SOITOOL_DIR, TESTDBNAME)
...
@@ -17,6 +17,8 @@ TESTDBPATH = os.path.join(SOITOOL_DIR, TESTDBNAME)
TESTDATA_PATH
=
Path
(
__file__
).
parent
.
parent
/
"
soitool/testdata
"
TESTDATA_PATH
=
Path
(
__file__
).
parent
.
parent
/
"
soitool/testdata
"
# Tolerance for timed tests. Tolrating DELTA seconds of difference
DELTA
=
2
class
DatabaseTest
(
unittest
.
TestCase
):
class
DatabaseTest
(
unittest
.
TestCase
):
"""
Database tests.
"""
"""
Database tests.
"""
...
@@ -141,7 +143,7 @@ class DatabaseTest(unittest.TestCase):
...
@@ -141,7 +143,7 @@ class DatabaseTest(unittest.TestCase):
# Calculates difference in seconds
# Calculates difference in seconds
time_diff
=
(
second_time
-
first_time
).
total_seconds
()
time_diff
=
(
second_time
-
first_time
).
total_seconds
()
# Compares difference with sleep_time
# Compares difference with sleep_time
self
.
assertAlmostEqual
(
time_diff
,
sleep_time
,
delta
=
2
)
self
.
assertAlmostEqual
(
time_diff
,
sleep_time
,
delta
=
DELTA
)
def
test_get_categories
(
self
):
def
test_get_categories
(
self
):
"""
Assert function get_categories works as expected.
"""
"""
Assert function get_categories works as expected.
"""
...
@@ -276,7 +278,7 @@ class DatabaseTest(unittest.TestCase):
...
@@ -276,7 +278,7 @@ class DatabaseTest(unittest.TestCase):
expected_time
=
seconds_in_24h
-
sleep_time
expected_time
=
seconds_in_24h
-
sleep_time
actual_time
=
self
.
database
.
seconds_to_next_update
(
seconds_in_24h
)
actual_time
=
self
.
database
.
seconds_to_next_update
(
seconds_in_24h
)
# Compares expected and function return value with
# Compares expected and function return value with
self
.
assertAlmostEqual
(
expected_time
,
actual_time
,
delta
=
0.2
)
self
.
assertAlmostEqual
(
expected_time
,
actual_time
,
delta
=
DELTA
)
def
teset_seconds_to_next_update_complete_period
(
self
):
def
teset_seconds_to_next_update_complete_period
(
self
):
"""
Check that seconds to next update can returns 0 and not negative.
"""
"""
Check that seconds to next update can returns 0 and not negative.
"""
...
...
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