Browse Source

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 years ago
parent
commit
2a33ba3266
1 changed files with 2 additions and 1 deletions
  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')