Преглед на файлове

Disconnecting import_modules in test, because they leave this signal to produce exceptions in other tests for pytest in python versions 2.7 (#5125)

Bojan Jovanovic преди 6 години
родител
ревизия
2a33ba3266
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      t/unit/app/test_loaders.py

+ 2 - 1
t/unit/app/test_loaders.py

@@ -93,10 +93,11 @@ class test_LoaderBase:
         def trigger_exception(**kwargs):
             raise ImportError('Dummy ImportError')
         from celery.signals import import_modules
-        import_modules.connect(trigger_exception)
+        x = import_modules.connect(trigger_exception)
         self.app.conf.imports = ('os', 'sys')
         with pytest.raises(ImportError):
             self.loader.import_default_modules()
+        import_modules.disconnect(x)
 
     def test_import_from_cwd_custom_imp(self):
         imp = Mock(name='imp')