#32913: test_glob inside utils_tests.test_autoreload.WatchmanReloaderTests is 
flaky
------------------------------------------------+------------------------
               Reporter:  Abhyudai              |          Owner:  nobody
                   Type:  Cleanup/optimization  |         Status:  new
              Component:  Testing framework     |        Version:  dev
               Severity:  Normal                |       Keywords:
           Triage Stage:  Unreviewed            |      Has patch:  0
    Needs documentation:  0                     |    Needs tests:  0
Patch needs improvement:  0                     |  Easy pickings:  0
                  UI/UX:  0                     |
------------------------------------------------+------------------------
 The test sometimes raises an exception. The `traceback` on my local setup:

 {{{#!sh
 ERROR: test_glob (utils_tests.test_autoreload.WatchmanReloaderTests)
 ----------------------------------------------------------------------
 Traceback (most recent call last):
 File "../django/django/utils/autoreload.py", line 529, in update_watches
     self._update_watches()
 File "../django/django/utils/autoreload.py", line 518, in _update_watches
     self._watch_root(root)
 File "../django/django/utils/autoreload.py", line 438, in _watch_root
     result = self.client.query('watch-project', str(root.absolute()))
 File "../django/venv/lib/python3.8/site-packages/pywatchman/__init__.py",
 line 1052, in query
     res = self.receive()
 File "../django/venv/lib/python3.8/site-packages/pywatchman/__init__.py",
 line 960, in receive
     result = self.recvConn.receive()
   File "../django/venv/lib/python3.8/site-
 packages/pywatchman/__init__.py", line 695, in receive
 buf = [self.transport.readBytes(sniff_len)]
   File "../django/venv/lib/python3.8/site-
 packages/pywatchman/__init__.py", line 344, in readBytes
 raise SocketTimeout('timed out waiting for response')
 pywatchman.SocketTimeout: timed out waiting for response, while executing
 ('watch-project', '/tmp/django_p9emwuc2/tmpdx4bsuny')
 The above exception was the direct cause of the following exception:
 Traceback (most recent call last):
 File "/usr/lib/python3.8/unittest/case.py", line 60, in testPartExecutor
     yield
 File "/usr/lib/python3.8/unittest/case.py", line 676, in run
     self._callTestMethod(testMethod)
 File "/usr/lib/python3.8/unittest/case.py", line 633, in _callTestMethod
     method()
   File "/usr/lib/python3.8/unittest/mock.py", line 1325, in patched
 return func(*newargs, **newkeywargs)
   File "../django/tests/utils_tests/test_autoreload.py", line 542, in
 test_glob
     with self.tick_twice():
   File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
     return next(self.gen)
 File "../django/tests/utils_tests/test_autoreload.py", line 531, in
 tick_twice
     next(ticker)
   File "../django/django/utils/autoreload.py", line 556, in tick
     self.update_watches()
   File "../django/django/utils/autoreload.py", line 532, in update_watches
     if self.check_server_status(ex):
   File "../django/django/utils/autoreload.py", line 584, in
 check_server_status
     raise WatchmanUnavailable(str(inner_ex)) from inner_ex
 django.utils.autoreload.WatchmanUnavailable: timed out waiting for
 response, while executing ('watch-project',
 '/tmp/django_p9emwuc2/tmpdx4bsuny')
 }}}

 Till now, what I have observed is this only occurs when at least all the
 tests inside the `test_utils.test_autoreloader.WatchmanReloaderTest` class
 are run at once. I made a script that you may use to verify this:

 {{{#!sh
 #!/usr/bin/bash

 iteration=0
 while true; do
     iteration=$((iteration + 1))

     ./runtests.py utils_tests.test_autoreloader.WatchmanReloaderTests
     if [[ $? -ne 0 ]]; then
         echo -e "-----------\nit failed in the $iteration
 iteration--------------------\n"
         break
     fi
     echo -e "-------------\nrunning the $iteration
 iteration\n-----------------\n"
 done
 }}}

 The flakiness is highly rare when executing only running the tests under
 `WatchmanReloaderTests`, in my case it sometimes took close to 2000
 operations to fail. Although, when the whole test suite is run at once,
 the problems seems to occur more frequently(it occurred twice out of
 something like 10 times on my end)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32913>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/053.cca492f6309aafe2cd3e1082b9c590c8%40djangoproject.com.

Reply via email to