Skip to content

Commit

Permalink
Fix occasional spurious test failures. (#424)
Browse files Browse the repository at this point in the history
* Increase time limit on `test_comment_content`

* Fix a spurious "no current event loop" test error
  • Loading branch information
ANogin committed Feb 18, 2024
1 parent fd7fc5d commit f05d3ca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ofrak_core/test_ofrak/components/test_comments.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from datetime import timedelta
import pytest
from hypothesis import given, HealthCheck, settings
from hypothesis.strategies import text
Expand Down Expand Up @@ -38,7 +39,10 @@ async def test_adding_comments(executable_resource: Resource):
# We suppress the function_scoped_fixture health check because the executable_resource fixture
# doesn't need to be reset between individual runs of hypothesis (since the comment overrides
# the previous one every time).
@settings(suppress_health_check=[HealthCheck.function_scoped_fixture])
@settings(
suppress_health_check=[HealthCheck.function_scoped_fixture],
deadline=timedelta(seconds=5),
)
@given(comment_str=text())
async def test_comment_content(executable_resource: Resource, comment_str: str):
"""Test comments with all kinds of string contents."""
Expand Down
3 changes: 3 additions & 0 deletions ofrak_core/test_ofrak/unit/test_ofrak_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ async def run_component_with_installed_dependency(ofrak_context: OFRAKContext):


def test_get_ofrak_context_over_time():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)

# No active context before running OFRAK
with pytest.raises(InvalidStateError):
get_current_ofrak_context()
Expand Down

0 comments on commit f05d3ca

Please sign in to comment.