-
Notifications
You must be signed in to change notification settings - Fork 203
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test suite optimization: Migrate tests to pytest #917
Closed
Closed
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
96e7ca4
migrate test_cgroups.py
Naman-Priyadarshi 26fec82
migrate test_benchmark_definition.py
Naman-Priyadarshi 34d3580
update setup.cfg
Naman-Priyadarshi ee6519c
migrate test_analyze_run_result.py
Naman-Priyadarshi 46d9b5e
migrate test_results.py
Naman-Priyadarshi 2f981f1
forgot to add copyright text to test_result.py
Naman-Priyadarshi e75dff6
resolve changes
Naman-Priyadarshi d9e6a39
migrate test_util.py
Naman-Priyadarshi 5149bad
add pytest to dockerfile
d9f5be9
reformat tests
601cb77
reformat tests
1b8e51a
replace nose with pytest in workflow
ab25f20
migrate test_statvalue.py and test_util.py
Naman-Priyadarshi 891ea7c
reformat code
Naman-Priyadarshi 44fc7d0
Merge branch 'migrate-test-to-pytest' of https://github.com/sosy-lab/…
Naman-Priyadarshi 5f6fdfa
ruff changes
Naman-Priyadarshi a155144
Merge branch 'main' into migrate-test-to-pytest
Naman-Priyadarshi d218182
add file conftest.py
2359da2
use old util tests
7d1be54
reformat code
463105f
ruff changes
0041058
add license to test_statvalue.py
ca47383
make changes to appveyor workflow to support pytest
d73d101
update dockerfile
6d2b876
add comment explaining conftest.py
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This file is part of BenchExec, a framework for reliable benchmarking: | ||
# https://github.com/sosy-lab/benchexec | ||
# | ||
# SPDX-FileCopyrightText: 2007-2020 Dirk Beyer <https://www.sosy-lab.org> | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
# The following code is intended for use in pytest sessions and ensures consistent rounding behavior during tests. | ||
# It sets the rounding mode to ROUND_HALF_UP for both the DefaultContext and the local context at the start of the session. | ||
# This helps maintain reproducibility in test results by avoiding discrepancies in rounding behavior across different environments or configurations. | ||
# The use of pytest_sessionstart hook from `conftest.py` ensures that this setup is applied globally at the beginning of each test session. | ||
|
||
import decimal | ||
|
||
original_default_rounding = decimal.DefaultContext.rounding | ||
original_local_rounding = decimal.getcontext().rounding | ||
|
||
|
||
def pytest_sessionstart(session): | ||
decimal.DefaultContext.rounding = decimal.ROUND_HALF_UP | ||
decimal.getcontext().rounding = decimal.ROUND_HALF_UP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought this can be kept now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have tried multiple ways so that we can still keep the double-checking assertion but the tests only work when it is removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that whenever this assertion fails, table-generator would do wrong computations! Actually, it would be to have a test that shows that, can you do that? This would then make it clear that we need a way for setting the correct rounding mode.