Skip to content

Commit

Permalink
Merge pull request #135 from VincentVanlaer/fix-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin committed Sep 3, 2023
2 parents 02daacb + 788fee3 commit e930e6f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 23 deletions.
1 change: 1 addition & 0 deletions docs/source/conf.py
Expand Up @@ -45,6 +45,7 @@
("py:obj", "bytes-like"),
]


# XX hack the RTD theme until
# https://github.com/rtfd/sphinx_rtd_theme/pull/382
# is shipped (should be in the release after 0.2.4)
Expand Down
5 changes: 0 additions & 5 deletions pytest_trio/_tests/test_async_fixture.py
Expand Up @@ -2,7 +2,6 @@


def test_single_async_fixture(testdir):

testdir.makepyfile(
"""
import pytest
Expand All @@ -25,7 +24,6 @@ async def test_simple(fix1):


def test_async_fixture_recomputed_for_each_test(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -56,7 +54,6 @@ async def test_second(fix1):


def test_nested_async_fixture(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -89,7 +86,6 @@ async def test_both(fix1, fix2):


def test_async_within_sync_fixture(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -122,7 +118,6 @@ async def test_simple(sync_fix):
# async fixture...
@pytest.mark.xfail(reason="Not implemented yet")
def test_raise_in_async_fixture_cause_pytest_error(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down
6 changes: 0 additions & 6 deletions pytest_trio/_tests/test_async_yield_fixture.py
Expand Up @@ -38,7 +38,6 @@ def test_after():


def test_nested_async_yield_fixture(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -93,7 +92,6 @@ def test_after():


def test_async_yield_fixture_within_sync_fixture(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -139,7 +137,6 @@ def test_after():


def test_async_yield_fixture_within_sync_yield_fixture(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -190,7 +187,6 @@ def test_after():


def test_async_yield_fixture_with_multiple_yields(testdir):

testdir.makepyfile(
"""
import pytest
Expand All @@ -217,7 +213,6 @@ async def test_actual_test(fix1):


def test_async_yield_fixture_with_nursery(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -253,7 +248,6 @@ async def test_actual_test(server):


def test_async_yield_fixture_crashed_teardown_allow_other_teardowns(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down
4 changes: 0 additions & 4 deletions pytest_trio/_tests/test_basic.py
Expand Up @@ -2,7 +2,6 @@


def test_async_test_is_executed(testdir):

testdir.makepyfile(
"""
import pytest
Expand All @@ -27,7 +26,6 @@ def test_check_async_test_called():


def test_async_test_as_class_method(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -60,7 +58,6 @@ def test_check_async_test_called():

@pytest.mark.xfail(reason="Raises pytest internal error so far...")
def test_sync_function_with_trio_mark(testdir):

testdir.makepyfile(
"""
import pytest
Expand All @@ -77,7 +74,6 @@ def test_invalid():


def test_skip_and_xfail(testdir):

testdir.makepyfile(
"""
import functools
Expand Down
21 changes: 16 additions & 5 deletions pytest_trio/_tests/test_hypothesis_interaction.py
@@ -1,10 +1,5 @@
import pytest
import trio
from trio.tests.test_scheduler_determinism import (
scheduler_trace,
test_the_trio_scheduler_is_not_deterministic,
test_the_trio_scheduler_is_deterministic_if_seeded,
)
from hypothesis import given, settings, strategies as st

from pytest_trio.plugin import _trio_test_runner_factory
Expand Down Expand Up @@ -38,6 +33,22 @@ async def test_mark_and_parametrize(x, y):
assert y in (1, 2)


async def scheduler_trace():
"""Returns a scheduler-dependent value we can use to check determinism."""
trace = []

async def tracer(name):
for i in range(10):
trace.append((name, i))
await trio.sleep(0)

async with trio.open_nursery() as nursery:
for i in range(5):
nursery.start_soon(tracer, i)

return tuple(trace)


def test_the_trio_scheduler_is_deterministic_under_hypothesis():
traces = []

Expand Down
3 changes: 0 additions & 3 deletions pytest_trio/_tests/test_sync_fixture.py
Expand Up @@ -12,7 +12,6 @@ async def test_single_sync_fixture(sync_fix):


def test_single_yield_fixture(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -47,7 +46,6 @@ def test_after():


def test_single_yield_fixture_with_async_deps(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down Expand Up @@ -90,7 +88,6 @@ def test_after():


def test_sync_yield_fixture_crashed_teardown_allow_other_teardowns(testdir):

testdir.makepyfile(
"""
import pytest
Expand Down

0 comments on commit e930e6f

Please sign in to comment.