Horrible, nasty hack

This commit is contained in:
Hugo Osvaldo Barrera 2020-11-16 19:27:39 +01:00
parent 9df587df26
commit 53878f001a
2 changed files with 36 additions and 29 deletions

View file

@ -2,4 +2,3 @@ hypothesis>=5.0.0
pytest pytest
pytest-cov pytest-cov
pytest-localserver pytest-localserver
pytest-subtesthack

View file

@ -271,6 +271,9 @@ def test_multiple_pairs(tmpdir, runner):
} }
hack = 0
# XXX: https://github.com/pimutils/vdirsyncer/issues/617 # XXX: https://github.com/pimutils/vdirsyncer/issues/617
@pytest.mark.skipif(sys.platform == 'darwin', @pytest.mark.skipif(sys.platform == 'darwin',
reason='This test inexplicably fails') reason='This test inexplicably fails')
@ -291,10 +294,15 @@ def test_multiple_pairs(tmpdir, runner):
@example(collections=['persönlich']) @example(collections=['persönlich'])
@example(collections={'a', 'A'}) @example(collections={'a', 'A'})
@example(collections={'\ufffe'}) @example(collections={'\ufffe'})
def test_create_collections(subtest, collections): def test_create_collections(collections, tmpdir, runner):
# Hypothesis calls this tests in a way that fixtures are not reset, to tmpdir is the
# same for each call.
# This horrible hack creates a new subdirectory on each run, effectively giving us a
# new tmpdir each run.
global hack
hack += 1
tmpdir = tmpdir / f"sub{hack}"
@subtest
def test_inner(tmpdir, runner):
runner.write_with_general(dedent(''' runner.write_with_general(dedent('''
[pair foobar] [pair foobar]
a = "foo" a = "foo"