Replace global Conf mangling with monkeypatch

The test suite, especially for the brokers, was heavily dependant on the
success of the tests preceeding it to pass. This commit should eliminate
that dependency and allow tests to fail without affecting others.
It also removes the need to cleanup globals manually after a test.
This commit is contained in:
Harm Geerts
2016-11-29 18:08:52 +01:00
parent 82f3cbdf28
commit cf37efb1eb
6 changed files with 55 additions and 99 deletions
+2 -4
View File
@@ -11,8 +11,8 @@ from django_q.signing import SignedPackage
@pytest.mark.django_db
def test_admin_views(admin_client):
Conf.ORM = 'default'
def test_admin_views(admin_client, monkeypatch):
monkeypatch.setattr(Conf, 'ORM', 'default')
s = schedule('schedule.test')
tag = uuid()
f = Task.objects.create(
@@ -78,5 +78,3 @@ def test_admin_views(admin_client):
data = {'post': 'yes'}
response = admin_client.post(url, data)
assert response.status_code == 302
# cleanup
Conf.ORM = None