mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-02 07:48:12 +08:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user