@@ -271,6 +271,9 @@ def get_cfg():
271
271
}
272
272
273
273
274
+ hack = 0
275
+
276
+
274
277
# XXX: https://github.com/pimutils/vdirsyncer/issues/617
275
278
@pytest .mark .skipif (sys .platform == 'darwin' ,
276
279
reason = 'This test inexplicably fails' )
@@ -291,40 +294,45 @@ def get_cfg():
291
294
@example (collections = ['persönlich' ])
292
295
@example (collections = {'a' , 'A' })
293
296
@example (collections = {'\ufffe ' })
294
- def test_create_collections (subtest , collections ):
295
-
296
- @subtest
297
- def test_inner (tmpdir , runner ):
298
- runner .write_with_general (dedent ('''
299
- [pair foobar]
300
- a = "foo"
301
- b = "bar"
302
- collections = {colls}
303
-
304
- [storage foo]
305
- type = "filesystem"
306
- path = "{base}/foo/"
307
- fileext = ".txt"
308
-
309
- [storage bar]
310
- type = "filesystem"
311
- path = "{base}/bar/"
312
- fileext = ".txt"
313
- ''' .format (base = str (tmpdir ), colls = json .dumps (list (collections )))))
314
-
315
- result = runner .invoke (
316
- ['discover' ],
317
- input = 'y\n ' * 2 * (len (collections ) + 1 )
318
- )
319
- assert not result .exception , result .output
320
-
321
- result = runner .invoke (
322
- ['sync' ] + ['foobar/' + x for x in collections ]
323
- )
324
- assert not result .exception , result .output
325
-
326
- assert {x .basename for x in tmpdir .join ('foo' ).listdir ()} == \
327
- {x .basename for x in tmpdir .join ('bar' ).listdir ()}
297
+ def test_create_collections (collections , tmpdir , runner ):
298
+ # Hypothesis calls this tests in a way that fixtures are not reset, to tmpdir is the
299
+ # same for each call.
300
+ # This horrible hack creates a new subdirectory on each run, effectively giving us a
301
+ # new tmpdir each run.
302
+ global hack
303
+ hack += 1
304
+ tmpdir = tmpdir / f"sub{ hack } "
305
+
306
+ runner .write_with_general (dedent ('''
307
+ [pair foobar]
308
+ a = "foo"
309
+ b = "bar"
310
+ collections = {colls}
311
+
312
+ [storage foo]
313
+ type = "filesystem"
314
+ path = "{base}/foo/"
315
+ fileext = ".txt"
316
+
317
+ [storage bar]
318
+ type = "filesystem"
319
+ path = "{base}/bar/"
320
+ fileext = ".txt"
321
+ ''' .format (base = str (tmpdir ), colls = json .dumps (list (collections )))))
322
+
323
+ result = runner .invoke (
324
+ ['discover' ],
325
+ input = 'y\n ' * 2 * (len (collections ) + 1 )
326
+ )
327
+ assert not result .exception , result .output
328
+
329
+ result = runner .invoke (
330
+ ['sync' ] + ['foobar/' + x for x in collections ]
331
+ )
332
+ assert not result .exception , result .output
333
+
334
+ assert {x .basename for x in tmpdir .join ('foo' ).listdir ()} == \
335
+ {x .basename for x in tmpdir .join ('bar' ).listdir ()}
328
336
329
337
330
338
def test_ident_conflict (tmpdir , runner ):
0 commit comments