Ask Solem 12 lat temu
rodzic
commit
f36d0cf685

+ 4 - 0
celery/tests/utilities/test_platforms.py

@@ -284,11 +284,15 @@ if not current_app.IS_WINDOWS:
             geteuid.return_value = 5001
             context = detached(uid='user', gid='group', logfile='/foo/bar')
             self.assertIsInstance(context, DaemonContext)
+            self.assertTrue(context.after_chdir)
+            context.after_chdir()
             open.assert_called_with('/foo/bar', 'a')
             open.return_value.close.assert_called_with()
 
             context = detached(pidfile='/foo/bar/pid')
             self.assertIsInstance(context, DaemonContext)
+            self.assertTrue(context.after_chdir)
+            context.after_chdir()
             pidlock.assert_called_with('/foo/bar/pid')
 
     class test_DaemonContext(Case):

+ 1 - 1
docs/reference/celery.rst

@@ -89,7 +89,7 @@ Application
         Only necessary for dynamically created apps for which you can
         use the with statement::
 
-            with Celery(...) as app:
+            with Celery(set_as_current=False) as app:
                 with app.connection() as conn:
                     pass