• 
      

    Switch Djblets's test suite to use pytest.

    Review Request #11919 — Created Jan. 10, 2022 and submitted

    Information

    Djblets
    release-3.x

    Reviewers

    Historically, we've used nose as the test runner, with a custom test
    runner script responsible for setting up a test run.

    Unfortunately, nose 1.x hasn't been updated in a long while, and isn't
    compatible with modern versions of Python 3. The forks also don't
    support Python 3 very well. nose2 does, but is so different that it's
    not a great option for us.

    Instead, we're moving to pytest. This is a much more modern test
    runner with a lot of interesting capabilities and a wide ecosystem of
    plugins.

    We now use this and define what little test setup we still need in
    conftest.py, which is where we can define hooks for pytest to load.

    We also use the pytest-django module, which is an official pytest
    plugin for setting up a Django environment.

    Developers can now run pytest directly to run the test suite. The old
    ./tests/runtests.py still works, but is deprecated, and merely wraps
    pytests anyway.

    Note that we still have a test runner we ship with Django that uses
    nose. For now, this will continue to use nose, but we won't be using
    it. We will need to evaluate a modernization or deprecation plan for
    this.

    Unit tests pass for all supported versions of Python.

    Summary ID
    Switch Djblets's test suite to use pytest.
    Historically, we've used `nose` as the test runner, with a custom test runner script responsible for setting up a test run. Unfortunately, `nose` 1.x hasn't been updated in a long while, and isn't compatible with modern versions of Python 3. The forks also don't support Python 3 very well. `nose2` does, but is so different that it's not a great option for us. Instead, we're moving to `pytest`. This is a much more modern test runner with a lot of interesting capabilities and a wide ecosystem of plugins. We now use this and define what little test setup we still need in `conftest.py`, which is where we can define hooks for `pytest` to load. We also use the `pytest-django` module, which is an official `pytest` plugin for setting up a Django environment. Developers can now run `pytest` directly to run the test suite. The old `./tests/runtests.py` still works, but is deprecated, and merely wraps `pytests` anyway. Note that we still have a test runner we ship with Django that uses `nose`. For now, this will continue to use `nose`, but we won't be using it. We will need to evaluate a modernization or deprecation plan for this.
    360fab0637388076b0989c339deafca2c888df6f
    Description From Last Updated

    F401 'djblets.util.compat.python.collections' imported but unused

    reviewbotreviewbot

    F401 'unittest.SkipTest' imported but unused

    reviewbotreviewbot
    Checks run (1 failed, 1 succeeded)
    flake8 failed.
    JSHint passed.

    flake8

    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Change Summary:

    Updated for Djblets 3.0.

    Commits:
    Summary ID
    Switch Djblets's test suite to use pytest.
    Historically, we've used `nose` as the test runner, with a custom test runner script responsible for setting up a test run. Unfortunately, `nose` 1.x hasn't been updated in a long while, and isn't compatible with modern versions of Python 3. The forks also don't support Python 3 very well. `nose2` does, but is so different that it's not a great option for us. Instead, we're moving to `pytest`. This is a much more modern test runner with a lot of interesting capabilities and a wide ecosystem of plugins. We now use this and define what little test setup we still need in `conftest.py`, which is where we can define hooks for `pytest` to load. We also use the `pytest-django` module, which is an official `pytest` plugin for setting up a Django environment. Developers can now run `pytest` directly to run the test suite. The old `./tests/runtests.py` still works, but is deprecated, and merely wraps `pytests` anyway. Note that we still have a test runner we ship with Django that uses `nose`. For now, this will continue to use `nose`, but we won't be using it. We will need to evaluate a modernization or deprecation plan for this.
    24035fdce5a6d6dc0e34276e209ae4650c0be091
    Switch Djblets's test suite to use pytest.
    Historically, we've used `nose` as the test runner, with a custom test runner script responsible for setting up a test run. Unfortunately, `nose` 1.x hasn't been updated in a long while, and isn't compatible with modern versions of Python 3. The forks also don't support Python 3 very well. `nose2` does, but is so different that it's not a great option for us. Instead, we're moving to `pytest`. This is a much more modern test runner with a lot of interesting capabilities and a wide ecosystem of plugins. We now use this and define what little test setup we still need in `conftest.py`, which is where we can define hooks for `pytest` to load. We also use the `pytest-django` module, which is an official `pytest` plugin for setting up a Django environment. Developers can now run `pytest` directly to run the test suite. The old `./tests/runtests.py` still works, but is deprecated, and merely wraps `pytests` anyway. Note that we still have a test runner we ship with Django that uses `nose`. For now, this will continue to use `nose`, but we won't be using it. We will need to evaluate a modernization or deprecation plan for this.
    42fcf9d6be01902cbd6d67ae51daf3f332a467da
    Branch:
    release-2.x
    release-3.x

    Checks run (1 failed, 1 succeeded)

    flake8 failed.
    JSHint passed.

    flake8

    chipx86
    david
    1. Ship It!
    2. 
        
    chipx86
    Review request changed
    Status:
    Completed
    Change Summary:
    Pushed to release-3.x (4be5d5b)