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

Drop nose #13909

Merged
merged 4 commits into from
Nov 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/source/dev/run_tests_help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
'run_tests.sh -selenium (test_selector)' for running specified selenium web tests (using pytest selector syntax)

This wrapper script largely serves as a point documentation and convenience for
running Galaxy's Python tests. Most Python tests shipped with Galaxy can be run with
running Galaxy's Python tests. All Python tests shipped with Galaxy can be run with
pytest directly. Galaxy's client unit tests can be run with make client-test
or yarn directly as documented in detail in client/README.md.

Expand All @@ -44,7 +44,7 @@ The main test types are as follows:
framework twill to test ToolShed related functionality. These are
located in lib/tool_shed/test.

Python testing is mostly done via pytest. Specific tests can be selected
Python testing is done via pytest. Specific tests can be selected
using the syntax described at https://docs.pytest.org/en/latest/how-to/usage.html .
A few examples are shown below.

Expand Down Expand Up @@ -142,7 +142,7 @@ Extra options:
--no_cleanup Do not delete temp files for Python functional tests
(-toolshed, -framework, etc...)
--coverage Generate a test coverage report. This option currently
should work with every test that uses pytest, but the
works with every python test, but the
results may not be reliable with selenium or other
frameworks that primarily test the client.
--debug On python test error or failure invoke a pdb shell for
Expand Down
8 changes: 0 additions & 8 deletions doc/source/lib/galaxy_test.base.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,6 @@ galaxy\_test.base.interactor module
:undoc-members:
:show-inheritance:

galaxy\_test.base.nose\_util module
-----------------------------------

.. automodule:: galaxy_test.base.nose_util
:members:
:undoc-members:
:show-inheritance:

galaxy\_test.base.populators module
-----------------------------------

Expand Down
2 changes: 0 additions & 2 deletions lib/galaxy/dependencies/dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ mistune==0.8.4 ; python_version >= "3.7" and python_version < "3.11"
msgpack==1.0.4 ; python_version >= "3.7" and python_version < "3.11"
multidict==6.0.2 ; python_version >= "3.7" and python_version < "3.11"
mypy-extensions==0.4.3 ; python_version >= "3.7" and python_version < "3.11"
nose==1.3.7 ; python_version >= "3.7" and python_version < "3.11"
nosehtml==0.4.6 ; python_version >= "3.7" and python_version < "3.11"
numpy==1.21.6 ; python_version >= "3.7" and python_version < "3.11"
outcome==1.2.0 ; python_version >= "3.7" and python_version < "3.11"
packaging==21.3 ; python_version >= "3.7" and python_version < "3.11"
Expand Down
1 change: 0 additions & 1 deletion lib/galaxy/dependencies/pinned-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ multidict==6.0.2 ; python_version >= "3.7" and python_version < "3.11"
mypy-extensions==0.4.3 ; python_version >= "3.7" and python_version < "3.11"
networkx==2.5 ; python_version >= "3.7" and python_version < "3.11"
nodeenv==1.7.0 ; python_version >= "3.7" and python_version < "3.11"
nose==1.3.7 ; python_version >= "3.7" and python_version < "3.11"
numpy==1.21.6 ; python_version >= "3.7" and python_version < "3.11"
oauthlib==3.2.2 ; python_version >= "3.7" and python_version < "3.11"
oyaml==1.0 ; python_version >= "3.7" and python_version < "3.11"
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/tool_util/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def found_warns(self) -> bool:
return len(self.warn_messages) > 0

def lint(self, name: str, lint_func: Callable[[LintTargetType, "LintContext"], None], lint_target: LintTargetType):
name = name.replace("tsts", "tests")[len("lint_") :]
name = name[len("lint_") :]
if name in self.skip_types:
return

Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy/tool_util/linters/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
from ..verify import asserts


# Misspelled so as not be picked up by nosetests.
def lint_tsts(tool_xml, lint_ctx):
def lint_tests(tool_xml, lint_ctx):
nsoranzo marked this conversation as resolved.
Show resolved Hide resolved
# determine node to report for general problems with tests
tests = tool_xml.findall("./tests/test")
general_node = tool_xml.find("./tests")
Expand Down
11 changes: 0 additions & 11 deletions lib/galaxy/tool_util/verify/interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@
from requests.cookies import RequestsCookieJar
from typing_extensions import Protocol

try:
from nose.tools import nottest
except ImportError:

def nottest(x):
return x


from galaxy import util
from galaxy.tool_util.parser.interface import (
TestCollectionDef,
Expand Down Expand Up @@ -374,13 +366,11 @@ def publish_history(self, history_id):
response = self._put(f"histories/{history_id}", json.dumps({"published": True}))
response.raise_for_status()

@nottest
def test_data_path(self, tool_id, filename, tool_version=None):
version_fragment = f"&tool_version={tool_version}" if tool_version else ""
response = self._get(f"tools/{tool_id}/test_data_path?filename={filename}{version_fragment}", admin=True)
return response.json()

@nottest
def test_data_download(self, tool_id, filename, mode="file", is_output=True, tool_version=None):
result = None
local_path = None
Expand Down Expand Up @@ -1585,7 +1575,6 @@ def to_dict(self):
}


@nottest
def test_data_iter(required_files):
for fname, extra in required_files:
data_dict = dict(
Expand Down
9 changes: 0 additions & 9 deletions lib/galaxy/tools/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,9 @@
unicodify,
)

try:
from nose.tools import nottest
except ImportError:

def nottest(x):
return x


log = logging.getLogger(__name__)


@nottest
def parse_tests(tool, tests_source):
"""
Build ToolTestDescription objects for each "<test>" elements and
Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy_test/api/test_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import time
import urllib.parse
from operator import itemgetter
from unittest import SkipTest

import requests
from dateutil.parser import isoparse
Expand Down Expand Up @@ -601,8 +602,6 @@ def test_purging_output_cleaned_after_ok_run(self, history_id):
assert not os.path.exists(output_dataset_paths[0])

def _hack_to_skip_test_if_state_ok(self, job_state):
from nose.plugins.skip import SkipTest

if job_state().json()["state"] == "ok":
message = "Job state switch from running to ok too quickly - the rest of the test requires the job to be in a running state. Skipping test."
raise SkipTest(message)
Expand Down
87 changes: 0 additions & 87 deletions lib/galaxy_test/base/instrument.py

This file was deleted.

26 changes: 0 additions & 26 deletions lib/galaxy_test/base/nose_util.py

This file was deleted.

76 changes: 3 additions & 73 deletions lib/galaxy_test/driver/driver_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@
)
from urllib.parse import urlparse

import nose.config
import nose.core
import nose.loader
import nose.plugins.manager

from galaxy.app import UniverseApplication as GalaxyUniverseApplication
from galaxy.config import LOGGING_CONFIG_DEFAULT
from galaxy.model import mapping
Expand Down Expand Up @@ -54,8 +49,6 @@
DEFAULT_WEB_HOST,
target_url_parts,
)
from galaxy_test.base.instrument import StructuredTestDataPlugin
from galaxy_test.base.nose_util import run
from tool_shed.webapp.app import UniverseApplication as ToolshedUniverseApplication
from tool_shed.webapp.fast_app import initialize_fast_app as init_tool_shed_fast_app
from .test_logging import logging_config_file
Expand Down Expand Up @@ -102,19 +95,6 @@ def get_galaxy_test_tmp_dir():
return galaxy_test_tmp_dir


def configure_environment():
"""Hack up environment for test cases."""
# no op remove if unused
if "HTTP_ACCEPT_LANGUAGE" not in os.environ:
os.environ["HTTP_ACCEPT_LANGUAGE"] = DEFAULT_LOCALES

# Used by get_filename in tool shed's twilltestcase.
if "TOOL_SHED_TEST_FILE_DIR" not in os.environ:
os.environ["TOOL_SHED_TEST_FILE_DIR"] = TOOL_SHED_TEST_DATA

os.environ["GALAXY_TEST_ENVIRONMENT_CONFIGURED"] = "1"


def build_logger():
"""Build a logger for test driver script."""
return log
Expand Down Expand Up @@ -340,36 +320,6 @@ def _tool_data_table_config_path(default_tool_data_table_config_path=None):
return tool_data_table_config_path


def nose_config_and_run(argv=None, env=None, ignore_files=None, plugins=None):
"""Setup a nose context and run tests.

Tests are specified by argv (defaulting to sys.argv).
"""
if env is None:
env = os.environ
if ignore_files is None:
ignore_files = []
if plugins is None:
plugins = nose.plugins.manager.DefaultPluginManager()
if argv is None:
argv = sys.argv

test_config = nose.config.Config(
env=os.environ,
ignoreFiles=ignore_files,
plugins=plugins,
)

# Add custom plugin to produce JSON data used by planemo.
test_config.plugins.addPlugin(StructuredTestDataPlugin())
test_config.configure(argv)

result = run(test_config)

success = result.wasSuccessful()
return success


def copy_database_template(source, db_path):
"""Copy a 'clean' sqlite template database.

Expand Down Expand Up @@ -870,7 +820,7 @@ def launch_server(app_factory, webapp_factory, prefix=DEFAULT_CONFIG_PREFIX, gal
class TestDriver:
"""Responsible for the life-cycle of a Galaxy-style functional test.

Sets up servers, configures tests, runs nose, and tears things
Sets up servers, configures tests, and tears things
down. This is somewhat like a Python TestCase - but different
because it is meant to provide a main() endpoint.
"""
Expand All @@ -886,7 +836,7 @@ def setup(self):
"""Called before tests are built."""

def build_tests(self):
"""After environment is setup, setup nose tests."""
"""After environment is setup, setup tests."""

def tear_down(self):
"""Cleanup resources tracked by this object."""
Expand Down Expand Up @@ -914,28 +864,9 @@ def mkdtemp(self):
self.temp_directories.append(temp_directory)
return temp_directory

def run(self):
"""Driver whole test.

Setup environment, build tests (if needed), run test,
and finally cleanup resources.
"""
configure_environment()
self.setup()
self.build_tests()
try:
success = nose_config_and_run()
return 0 if success else 1
except Exception as e:
log.info("Failure running tests")
raise e
finally:
log.info("Shutting down")
self.tear_down()


class GalaxyTestDriver(TestDriver):
"""Instantial a Galaxy-style nose TestDriver for testing Galaxy."""
"""Instantial a Galaxy-style TestDriver for testing Galaxy."""

server_wrappers: List[ServerWrapper]
testing_shed_tools = False
Expand Down Expand Up @@ -1113,7 +1044,6 @@ def drive_test(test_driver_class):
"FRAMEWORK_DATATYPES_CONF",
"database_conf",
"get_webapp_global_conf",
"nose_config_and_run",
"setup_galaxy_config",
"TestDriver",
"wait_for_http_server",
Expand Down
Loading