Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test workers #1995

Closed
wants to merge 20 commits into from
Closed

Test workers #1995

wants to merge 20 commits into from

Commits on Jun 4, 2023

  1. Configuration menu
    Copy the full SHA
    1fa3846 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4b8923d View commit details
    Browse the repository at this point in the history
  3. Update coverage configuration for subprocesses

    - Enable the required parallel mode
    - Set the required `COVERAGE_PROCESS_START` environment variable
    - Add `coverage_enable_subprocess` for `coverage.process_startup`
    - Combine coverage reports before reporting coverage
    - Update `.gitignore` to ignore files named `.coverage*`
    
    https://coverage.readthedocs.io/en/latest/subprocess.html
    br3ndonland committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    0844cf3 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    65a16c7 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    1be545c View commit details
    Browse the repository at this point in the history
  6. Handle flaky signals in Gunicorn worker tests

    Occasional flakes are seen with some less-common signals.
    This commit will add some simple conditionals to avoid `AssertionError`
    exceptions when those signals are not handled as expected.
    br3ndonland committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    ab4a73c View commit details
    Browse the repository at this point in the history
  7. Disable flaking file reloader tests

    `WatchFilesReload` flakes when used with coverage.py parallel mode.
    It may have to do with the threading in the `touch_soon` fixture.
    
    Other WatchGod and Watchfiles flake on Windows specifically. Errors:
    
    ```text
    ================================== FAILURES ===================================
    ___________ TestBaseReload.test_override_defaults[WatchFilesReload] ___________
    
    self = <test_reload.TestBaseReload object at 0x0000014D4AB94160>
    touch_soon = <function touch_soon.<locals>.start at 0x0000014D4C3192D0>
    
        @pytest.mark.parametrize("reloader_class", [WatchFilesReload, WatchGodReload])
        def test_override_defaults(self, touch_soon) -> None:
            dotted_file = self.reload_path / ".dotted"
            dotted_dir_file = self.reload_path / ".dotted_dir" / "file.txt"
            python_file = self.reload_path / "main.py"
    
            with as_cwd(self.reload_path):
                config = Config(
                    app="tests.test_config:asgi_app",
                    reload=True,
                    # We need to add *.txt otherwise no regular files will match
                    reload_includes=[".*", "*.txt"],
                    reload_excludes=["*.py"],
                )
                reloader = self._setup_reloader(config)
    
                assert self._reload_tester(touch_soon, reloader, dotted_file)
                assert self._reload_tester(touch_soon, reloader, dotted_dir_file)
    >           assert not self._reload_tester(touch_soon, reloader, python_file)
    E           AssertionError: assert not [WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az811-309.2664.795750')]
    E            +  where [WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az811-309.2664.795750')] = <bound method TestBaseReload._reload_tester of <test_reload.TestBaseReload object at 0x0000014D4AB94160>>(<function touch_soon.<locals>.start at 0x0000014D4C3192D0>, <uvicorn.supervisors.watchfilesreload.WatchFilesReload object at 0x0000014D4C39DEA0>, WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/main.py'))
    E            +    where <bound method TestBaseReload._reload_tester of <test_reload.TestBaseReload object at 0x0000014D4AB94160>> = <test_reload.TestBaseReload object at 0x0000014D4AB94160>._reload_tester
    
    tests\supervisors\test_reload.py:253: AssertionError
    ---------------------------- Captured stderr call -----------------------------
    INFO:     Will watch for changes in these directories: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\reload_directory1']
    INFO:     Started reloader process [6280] using WatchFiles
    ------------------------------ Captured log call ------------------------------
    INFO     uvicorn.error:config.py:345 Will watch for changes in these directories: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\reload_directory1']
    INFO     uvicorn.error:basereload.py:77 Started reloader process [6280] using WatchFiles
    ____________ TestBaseReload.test_override_defaults[WatchGodReload] ____________
    
    self = <test_reload.TestBaseReload object at 0x0000014D4AB959F0>
    touch_soon = <function touch_soon.<locals>.start at 0x0000014D4C3E77F0>
    
        @pytest.mark.parametrize("reloader_class", [WatchFilesReload, WatchGodReload])
        def test_override_defaults(self, touch_soon) -> None:
            dotted_file = self.reload_path / ".dotted"
            dotted_dir_file = self.reload_path / ".dotted_dir" / "file.txt"
            python_file = self.reload_path / "main.py"
    
            with as_cwd(self.reload_path):
                config = Config(
                    app="tests.test_config:asgi_app",
                    reload=True,
                    # We need to add *.txt otherwise no regular files will match
                    reload_includes=[".*", "*.txt"],
                    reload_excludes=["*.py"],
                )
                reloader = self._setup_reloader(config)
    
                assert self._reload_tester(touch_soon, reloader, dotted_file)
    >           assert self._reload_tester(touch_soon, reloader, dotted_dir_file)
    
    tests\supervisors\test_reload.py:252:
    _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
    
    self = <test_reload.TestBaseReload object at 0x0000014D4AB959F0>
    touch_soon = <function touch_soon.<locals>.start at 0x0000014D4C3E77F0>
    reloader = <uvicorn.supervisors.watchgodreload.WatchGodReload object at 0x0000014D4C39DAB0>
    files = (WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.dotted_dir/file.txt'),)
    @py_assert2 = [WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az...s/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az811-309.4856.060689')]
    @py_assert4 = False
    @py_format5 = "assert not [WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.co...v-az811-309.4856.060689')] = next(<uvicorn.supervisors.watchgodreload.WatchGodReload object at 0x0000014D4C39DAB0>)\n}"
    
        def _reload_tester(
            self, touch_soon, reloader: BaseReload, *files: Path
        ) -> Optional[List[Path]]:
            reloader.restart()
            if WatchFilesReload is not None and isinstance(reloader, WatchFilesReload):
                touch_soon(*files)
            else:
    >           assert not next(reloader)
    E           AssertionError: assert not [WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az...s/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az811-309.4856.060689')]
    E            +  where [WindowsPath('C:/Users/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az...s/runneradmin/AppData/Local/Temp/pytest-of-runneradmin/pytest-0/reload_directory1/.coverage.fv-az811-309.4856.060689')] = next(<uvicorn.supervisors.watchgodreload.WatchGodReload object at 0x0000014D4C39DAB0>)
    
    tests\supervisors\test_reload.py:63: AssertionError
    ---------------------------- Captured stderr call -----------------------------
    INFO:     Will watch for changes in these directories: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\reload_directory1']
    INFO:     Started reloader process [6280] using WatchGod
    ------------------------------ Captured log call ------------------------------
    INFO     uvicorn.error:config.py:345 Will watch for changes in these directories: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\pytest-of-runneradmin\\pytest-0\\reload_directory1']
    INFO     uvicorn.error:basereload.py:77 Started reloader process [6280] using WatchGod
    ```
    br3ndonland committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    210f382 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    1ab8202 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    dda05fc View commit details
    Browse the repository at this point in the history
  10. Disable GitHub Actions fail-fast

    The GitHub Actions `jobs.<job_id>.strategy.fail-fast` setting controls
    how failures are handled. The default of `true` will fail the entire job
    when any job in the matrix fails.
    
    With the introduction of platform-specific worker testing, subprocesses,
    and operating system signal handling, there is potential for specific
    workflow jobs to occasionally fail. In these cases, it can help to set
    `fail-fast: false` to ensure that those specific failed jobs can be
    identified.
    
    https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
    br3ndonland committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    1d472e2 View commit details
    Browse the repository at this point in the history
  11. Add GitHub Actions timeout for tests

    With the introduction of platform-specific worker testing, subprocesses,
    and operating system signal handling, there is potential for specific
    workflow jobs to occasionally hang. In these cases, it can help to set
    a timeout on the test step to ensure the workflow jobs don't hang until
    the default 360 minute (6 hour) timeout.
    
    https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
    br3ndonland committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    fa7814c View commit details
    Browse the repository at this point in the history
  12. Update contributing docs

    - Explain how to skip subprocess tests by using the custom pytest marker
    - Explain how to re-run failed GitHub Actions jobs
    br3ndonland committed Jun 4, 2023
    Configuration menu
    Copy the full SHA
    0624d57 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    68dc870 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    cf737cc View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2023

  1. Revert "Disable GitHub Actions fail-fast"

    This reverts commit 1d472e2.
    br3ndonland committed Jun 6, 2023
    Configuration menu
    Copy the full SHA
    b1ab28c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9d4365a View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2023

  1. Configuration menu
    Copy the full SHA
    3add98c View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1bc61dd View commit details
    Browse the repository at this point in the history

Commits on Jun 16, 2023

  1. Merge branch 'master' into test-workers

    Conflicts:
    pyproject.toml
    requirements.txt
    br3ndonland committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    23adbdf View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    4923963 View commit details
    Browse the repository at this point in the history