From c48ae83b8cb8364f0091786e8fd1938ed116006c Mon Sep 17 00:00:00 2001 From: William Moore Date: Wed, 22 Jan 2020 14:00:04 +0000 Subject: [PATCH 01/10] Update testing instructions to use pytest directly Remove PYTHONPATH setting info, no longer needed --- omero/developers/testing.rst | 54 +++++++++++------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index f9ac04cdbe..78402db014 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -280,20 +280,20 @@ tests from :sourcedir:`components/tools/OmeroPy` using Since Python is interpreted, tests can be written and then run without having to rebuild or restart the server. A few basic options are shown below. -.. program:: setup.py test +First install dependencies:: + + $ pip install pytest, mox3, pyyaml -.. option:: -t , --test-path + # for Omeroweb tests + $ pip install pytest-django - This option specifies the test suite to run. For instance to run a single - test file:: +Run tests directly with pytest, setting the ICE_CONFIG as described above: - cd components/tools/OmeroPy - ./setup.py test -t test/integration/test_admin.py + export ICE_CONFIG=/path/to/openmicroscopy/etc/ice.config - Or to run all tests under a given folder:: + pytest test/integration/test_admin.py - cd components/tools/OmeroPy - ./setup.py test -t test/integration/clitest +.. program:: setup.py test .. option:: -k @@ -301,11 +301,11 @@ to rebuild or restart the server. A few basic options are shown below. their names. For example, to run all the tests under :file:`test/integration` with `permissions` in their names:: - ./setup.py test -t test/integration -k permissions + pytest test/integration -k permissions This option can also be used to run a named test within a test module:: - ./setup.py test -t test/integration/test_admin.py -k testGetGroup + pytest test/integration/test_admin.py -k testGetGroup .. option:: -m @@ -315,49 +315,27 @@ to rebuild or restart the server. A few basic options are shown below. For example, to run all integration tests excluding those decorated with the marker `broken`:: - ./setup.py test -t test/integration -m "not broken" + pytest test/integration -m "not broken" .. option:: --markers This option lists available markers for decorating tests:: - ./setup.py test --markers + pytest --markers .. option:: -s This option allows the standard output to be shown on the console:: - ./setup.py test -t test/integration/test_admin.py -s + pytest -t test/integration/test_admin.py -s .. option:: -h, --help This option displays the full list of available options:: - ./setup.py test -h - -To make use of the more advanced options available in `pytest` that are not -accessible using :program:`setup.py test`, the :program:`py.test` script can -be used directly. To use this :envvar:`PYTHONPATH` must contain the path to -the OMERO Python libraries, see |BlitzGateway| as well as the path to the -:py_sourcedir:`OMERO Python test library `. -Alternatively, the `pytest` plugin :pypi:`pytest-pythonpath` can be used to -add paths to :envvar:`PYTHONPATH` specifically for `pytest`. - -.. program:: py.test - -.. option:: --repeat - - This option allows to repeat tests for *number* occurences:: - - py.test --repeat 20 test/unit/fstest - -.. option:: -h, --help - - This option displays the full list of options:: - - py.test --help + pytest -h -and ``_ for more help in +See ``_ for more help in running tests. Failing tests From bd1a036a763480ea0b357bb5d3c816feb9446ed8 Mon Sep 17 00:00:00 2001 From: Will Moore Date: Wed, 22 Jan 2020 14:11:20 +0000 Subject: [PATCH 02/10] Update omero/developers/testing.rst Co-Authored-By: Josh Moore --- omero/developers/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index 78402db014..7b651e6a5c 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -282,7 +282,7 @@ to rebuild or restart the server. A few basic options are shown below. First install dependencies:: - $ pip install pytest, mox3, pyyaml + $ pip install pytest mox3 pyyaml # for Omeroweb tests $ pip install pytest-django From 7addc14167648d73982c1c907aa929e790888fa6 Mon Sep 17 00:00:00 2001 From: Will Moore Date: Thu, 23 Jan 2020 09:23:44 +0000 Subject: [PATCH 03/10] Update omero/developers/testing.rst Co-Authored-By: Mark Carroll --- omero/developers/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index 7b651e6a5c..bfbb6e8259 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -287,7 +287,7 @@ First install dependencies:: # for Omeroweb tests $ pip install pytest-django -Run tests directly with pytest, setting the ICE_CONFIG as described above: +Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described above: export ICE_CONFIG=/path/to/openmicroscopy/etc/ice.config From 28bf554e2d2478967c9aa74497ad7c593abbd831 Mon Sep 17 00:00:00 2001 From: William Moore Date: Thu, 23 Jan 2020 16:46:50 +0000 Subject: [PATCH 04/10] Mention venv, cd OmeroPy, fix setup.py -> pytest --- omero/developers/testing.rst | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index bfbb6e8259..9f27aec39e 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -276,11 +276,13 @@ Running tests directly When writing tests it can be more convenient, flexible and powerful to run the tests from :sourcedir:`components/tools/OmeroPy` using -:program:`setup.py test`. +:program:`pytest`. Since Python is interpreted, tests can be written and then run without having to rebuild or restart the server. A few basic options are shown below. -First install dependencies:: +First create a python virtual environment including ``omero-py`` +as described on the :doc:`OMERO Python ` page +and install dependencies:: $ pip install pytest mox3 pyyaml @@ -291,9 +293,14 @@ Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described ab export ICE_CONFIG=/path/to/openmicroscopy/etc/ice.config + cd components/tools/OmeroPy + + # OR for OmeroWeb tests: + cd components/tools/OmeroPy + pytest test/integration/test_admin.py -.. program:: setup.py test +.. program:: pytest .. option:: -k @@ -311,7 +318,7 @@ Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described ab This option will run integration tests depending on the markers they are decorated with. Available markers can be listed using the - :option:`setup.py test --markers` option. + :option:`pytest --markers` option. For example, to run all integration tests excluding those decorated with the marker `broken`:: @@ -466,8 +473,8 @@ markers can be simply defined as they are used. However, to centralize the use of custom markers they should be defined in :sourcedir:`components/tools/pytest.ini`. -To view all available markers the :option:`setup.py test --markers` option can -be used with :program:`setup.py test` or :program:`py.test` as detailed in +To view all available markers the :option:`pytest --markers` option can +be used with :program:`pytest` or :program:`py.test` as detailed in :ref:`running-python-tests-directly`. There is one custom marker defined: From a91746b8def418e113b13e5a49e53439a1ec273a Mon Sep 17 00:00:00 2001 From: William Moore Date: Thu, 23 Jan 2020 16:58:14 +0000 Subject: [PATCH 05/10] Mention OmeroWeb tests --- omero/developers/testing.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index 9f27aec39e..b8cb8aaead 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -275,8 +275,8 @@ Running tests directly """""""""""""""""""""" When writing tests it can be more convenient, flexible and powerful to run the -tests from :sourcedir:`components/tools/OmeroPy` using -:program:`pytest`. +tests from :sourcedir:`components/tools/OmeroPy` or +:sourcedir:`components/tools/OmeroWeb` using :program:`pytest`. Since Python is interpreted, tests can be written and then run without having to rebuild or restart the server. A few basic options are shown below. @@ -289,7 +289,7 @@ and install dependencies:: # for Omeroweb tests $ pip install pytest-django -Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described above: +Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described above:: export ICE_CONFIG=/path/to/openmicroscopy/etc/ice.config From 05b8f3698d5de090b93c701b09a3128bb3c4048d Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 24 Jan 2020 12:32:31 +0000 Subject: [PATCH 06/10] Fix OmeroWeb typo --- omero/developers/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index b8cb8aaead..fea1fcf9fb 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -296,7 +296,7 @@ Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described ab cd components/tools/OmeroPy # OR for OmeroWeb tests: - cd components/tools/OmeroPy + cd components/tools/OmeroWeb pytest test/integration/test_admin.py From 2c2dfad92bbc2b29ad869f0ca3aa2018db15136a Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 14 Feb 2020 09:50:17 +0000 Subject: [PATCH 07/10] Remove outdated -t flag --- omero/developers/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index fea1fcf9fb..ecbec244ed 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -334,7 +334,7 @@ Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described ab This option allows the standard output to be shown on the console:: - pytest -t test/integration/test_admin.py -s + pytest test/integration/test_admin.py -s .. option:: -h, --help From 27adfe7cb45ad7c0acc3a621afe7cbc8b648f504 Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 14 Feb 2020 10:08:13 +0000 Subject: [PATCH 08/10] Mention omero-web and pytables deps --- omero/developers/testing.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index ecbec244ed..c9c5eb6397 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -280,11 +280,13 @@ tests from :sourcedir:`components/tools/OmeroPy` or Since Python is interpreted, tests can be written and then run without having to rebuild or restart the server. A few basic options are shown below. -First create a python virtual environment including ``omero-py`` -as described on the :doc:`OMERO Python ` page -and install dependencies:: +First create a python virtual environment +as described on the :doc:`OMERO Python ` page, +including ``omero-py`` and ``omero-web`` if you want to run OmeroWeb tests. +Some tests also require install of PyTables. +Then install some additional test dependencies:: - $ pip install pytest mox3 pyyaml + $ pip install pytest mox3 pyyaml tables # for Omeroweb tests $ pip install pytest-django From f582c0495dcf46884f863c36482a467093f4d1c9 Mon Sep 17 00:00:00 2001 From: William Moore Date: Fri, 14 Feb 2020 10:16:09 +0000 Subject: [PATCH 09/10] Mention setting of OMERODIR --- omero/developers/testing.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index c9c5eb6397..5d342e2610 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -284,6 +284,7 @@ First create a python virtual environment as described on the :doc:`OMERO Python ` page, including ``omero-py`` and ``omero-web`` if you want to run OmeroWeb tests. Some tests also require install of PyTables. + Then install some additional test dependencies:: $ pip install pytest mox3 pyyaml tables @@ -291,9 +292,11 @@ Then install some additional test dependencies:: # for Omeroweb tests $ pip install pytest-django -Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described above:: +Run tests directly with pytest, setting the :envvar:`ICE_CONFIG` as described above. +Also set :envvar:`OMERODIR` to point to the OMERO.server:: export ICE_CONFIG=/path/to/openmicroscopy/etc/ice.config + export OMERODIR=/path/to/OMERO.server-x.x.x-ice36-bxx cd components/tools/OmeroPy From 2317a376416af0522b0684b7ee1d603425fce452 Mon Sep 17 00:00:00 2001 From: William Moore Date: Tue, 18 Feb 2020 12:21:52 +0000 Subject: [PATCH 10/10] the installation of --- omero/developers/testing.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omero/developers/testing.rst b/omero/developers/testing.rst index 5d342e2610..073748f23e 100644 --- a/omero/developers/testing.rst +++ b/omero/developers/testing.rst @@ -283,7 +283,7 @@ to rebuild or restart the server. A few basic options are shown below. First create a python virtual environment as described on the :doc:`OMERO Python ` page, including ``omero-py`` and ``omero-web`` if you want to run OmeroWeb tests. -Some tests also require install of PyTables. +Some tests also require the installation of PyTables. Then install some additional test dependencies::