You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by di...@apache.org on 2022/11/02 20:49:34 UTC

[allura] 04/07: [#8455] updated test docs, removed various old references to nose and replaced with pytest

This is an automated email from the ASF dual-hosted git repository.

dill0wn pushed a commit to branch pytest-finalize
in repository https://gitbox.apache.org/repos/asf/allura.git

commit 954da7fdc479221e94137125724584bb6d5774db
Author: Dillon Walls <di...@slashdotmedia.com>
AuthorDate: Tue Nov 1 15:30:08 2022 +0000

    [#8455] updated test docs, removed various old references to nose and replaced with pytest
---
 .travis.yml                                                  |  1 -
 Allura/allura/tests/test_commands.py                         |  1 -
 Allura/allura/tests/test_helpers.py                          |  1 -
 Allura/docs/development/contributing.rst                     |  9 +++------
 Allura/docs/getting_started/installation.rst                 |  5 ++---
 AlluraTest/alluratest/test_syntax.py                         |  2 +-
 CHANGES                                                      | 12 ++++++++++++
 .../forgetracker/tests/command/test_fix_discussion.py        |  1 -
 README.markdown                                              |  2 +-
 rat-excludes.txt                                             |  1 +
 10 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index e8511f751..14a74ff89 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,6 @@ jobs:
 install:
   - sudo apt-get install -qq libjpeg8-dev zlib1g-dev
   - pip install --upgrade setuptools pip
-  - pip install nose
   - pip install -r requirements.txt --no-deps --upgrade --upgrade-strategy=only-if-needed
   - npm ci
 script:
diff --git a/Allura/allura/tests/test_commands.py b/Allura/allura/tests/test_commands.py
index fadd8ad09..db9ae0296 100644
--- a/Allura/allura/tests/test_commands.py
+++ b/Allura/allura/tests/test_commands.py
@@ -44,7 +44,6 @@ class EmptyClass:
 
 
 def setup_module():
-    """Method called by nose before running each test"""
     setup_basic_test()
     setup_global_objects()
     setup_unit_test()
diff --git a/Allura/allura/tests/test_helpers.py b/Allura/allura/tests/test_helpers.py
index 571d33fea..21926356c 100644
--- a/Allura/allura/tests/test_helpers.py
+++ b/Allura/allura/tests/test_helpers.py
@@ -42,7 +42,6 @@ import six
 
 
 def setup_module():
-    """Method called by nose before running each test"""
     setup_basic_test()
 
 
diff --git a/Allura/docs/development/contributing.rst b/Allura/docs/development/contributing.rst
index bd9fcbf87..29ac70776 100644
--- a/Allura/docs/development/contributing.rst
+++ b/Allura/docs/development/contributing.rst
@@ -206,16 +206,13 @@ as ``pudb`` are also available.
 
 Testing
 -------
-First, install :code:`nose` (not bundled installed by default, since it is LGPL and deprecated)
-:code:`docker-compose run web pip install nose`
-
 To run all the tests, execute ``./run_tests`` in the repo root. To run tests
 for a single package, for example ``forgetracker``::
 
-  cd ForgeTracker && nosetests
+  cd ForgeTracker && pytest
 
-To learn more about the ``nose`` test runner, consult the `documentation
-<http://nose.readthedocs.org/en/latest/>`_.
+To learn more about the ``pytest`` test runner, consult the `documentation
+<https://docs.pytest.org/en/latest/contents.html>`_.
 
 When writing code for Allura, don't forget that you'll need to also create
 tests that cover behaviour that you've added or changed. You may find this
diff --git a/Allura/docs/getting_started/installation.rst b/Allura/docs/getting_started/installation.rst
index a89d2dbe2..c519c42cb 100644
--- a/Allura/docs/getting_started/installation.rst
+++ b/Allura/docs/getting_started/installation.rst
@@ -174,8 +174,7 @@ Update requirements and reinstall apps:
 You may want to restart at least "taskd" container after that in order for it to
 pick up changes.  Run :code:`docker-compose restart taskd`
 
-Running all tests.  First, install :code:`nose` (not bundled installed by default, since it is LGPL and deprecated)
-:code:`docker-compose run web pip install nose` then:
+Run all tests:
 
 .. code-block:: bash
 
@@ -185,7 +184,7 @@ Running subset of tests:
 
 .. code-block:: bash
 
-    docker-compose run web bash -c 'cd ForgeGit && nosetests forgegit.tests.functional.test_controllers:TestFork'
+    docker-compose run web bash -c 'cd ForgeGit && pytest forgegit/tests/functional/test_controllers.py::TestFork'
 
 Connecting to mongo using a container:
 
diff --git a/AlluraTest/alluratest/test_syntax.py b/AlluraTest/alluratest/test_syntax.py
index 0d93f4c0d..bd2ea0701 100644
--- a/AlluraTest/alluratest/test_syntax.py
+++ b/AlluraTest/alluratest/test_syntax.py
@@ -27,7 +27,7 @@ toplevel_dir = os.path.abspath(os.path.dirname(__file__) + "/../..")
 
 def run(cmd):
     proc = Popen(cmd, shell=True, cwd=toplevel_dir, stdout=PIPE, stderr=PIPE)
-    # must capture & reprint stdount, so that pytest can capture it
+    # must capture & reprint stdout, so that pytest can capture it
     (stdout, stderr) = proc.communicate()
     sys.stdout.write(stdout.decode('utf-8'))
     sys.stderr.write(stderr.decode('utf-8'))
diff --git a/CHANGES b/CHANGES
index bc2e43ded..672c16e40 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,15 @@
+Next Version
+
+Upgrade Instructions
+
+  More to come!
+
+General
+ * [#8445] Switched all tests from nose to pytest
+
+
+
+
 Version 1.14.0  (September 2022)
 
 Upgrade Instructions
diff --git a/ForgeTracker/forgetracker/tests/command/test_fix_discussion.py b/ForgeTracker/forgetracker/tests/command/test_fix_discussion.py
index 5d51ad120..e31609b77 100644
--- a/ForgeTracker/forgetracker/tests/command/test_fix_discussion.py
+++ b/ForgeTracker/forgetracker/tests/command/test_fix_discussion.py
@@ -30,7 +30,6 @@ test_config = pkg_resources.resource_filename(
 
 
 def setup_module(self):
-    """Method called by nose before running each test"""
     setup_basic_test()
     setup_global_objects()
 
diff --git a/README.markdown b/README.markdown
index b0bbc4b2e..4c1fdef30 100644
--- a/README.markdown
+++ b/README.markdown
@@ -25,7 +25,7 @@
 
 Allura is an open source implementation of a software "forge", a web site that manages source code repositories, bug reports, discussions, mailing lists, wiki pages, blogs and more for any number of individual projects.
 
-Allura is written in Python and leverages a great many existing Python packages (see requirements.txt and friends).  It comes with tests which we run with [nose](https://nose.readthedocs.org/en/latest/).  It is extensible in several ways, most importantly via the notion of "tools" based on `allura.app.Application`; but also with [themes, authentication, and various other pluggable-APIs](https://forge-allura.apache.org/docs/extending.html).
+Allura is written in Python and leverages a great many existing Python packages (see requirements.txt and friends).  It comes with tests which we run with [pytest](https://docs.pytest.org/en/latest/contents.html).  It is extensible in several ways, most importantly via the notion of "tools" based on `allura.app.Application`; but also with [themes, authentication, and various other pluggable-APIs](https://forge-allura.apache.org/docs/extending.html).
 
 Website: <https://allura.apache.org/>
 
diff --git a/rat-excludes.txt b/rat-excludes.txt
index c33bf1001..7c702e624 100644
--- a/rat-excludes.txt
+++ b/rat-excludes.txt
@@ -7,6 +7,7 @@
 **/.pytest_cache/
 **/MANIFEST.in
 **/nosetests.xml
+**/pytest.junit.xml
 **/setup.cfg
 .eslintignore-es5
 .eslintignore-es6