vdirsyncer/tests/storage/conftest.py
Hugo Osvaldo Barrera b1b4dd92fe Sort imports
I don't want to ever have to sort imports again. It's a poor use of
developer time. Automate this with a pre-commit hook, and check this on
CI.

Developers: I suggest you configure your editor to use
`reorder_python_imports`. It uses the standard sorting, and detects
first/third party libs well.
2020-06-09 14:34:45 +02:00

34 lines
787 B
Python

import uuid
import pytest
@pytest.fixture
def slow_create_collection(request):
# We need to properly clean up because otherwise we might run into
# storage limits.
to_delete = []
def delete_collections():
for s in to_delete:
s.session.request('DELETE', '')
request.addfinalizer(delete_collections)
def inner(cls, args, collection):
assert collection.startswith('test')
collection += '-vdirsyncer-ci-' + str(uuid.uuid4())
args = cls.create_collection(collection, **args)
s = cls(**args)
_clear_collection(s)
assert not list(s.list())
to_delete.append(s)
return args
return inner
def _clear_collection(s):
for href, etag in s.list():
s.delete(href, etag)