Skip to content

Commit

Permalink
Merge pull request #38 from cehbrecht/mark-slow-tests
Browse files Browse the repository at this point in the history
mark slow tests
  • Loading branch information
cehbrecht committed Aug 1, 2019
2 parents ecbf93f + 1a1abbe commit cf0efe6
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 13 deletions.
7 changes: 7 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
include LICENSE
include Makefile
include *.txt
include *.rst
recursive-include pyesgf *
global-exclude *.*~
global-exclude __pycache__
global-exclude *.py[co]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ clean-test: ## remove test and coverage artifacts
rm -fr .pytest_cache

lint: ## check style with flake8
flake8 pyesgf
flake8 pyesgf tests

test: ## run tests quickly with the default Python
pytest -v -m 'not slow and not online'
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ github_. Pull requests are always welcome.

Full documentation_ is available on ReadTheDocs or in the docs directory.

.. _`Earth System Grid Federation`: http://esgf.org
.. _`Earth System Grid Federation`: https://esgf.llnl.gov/
.. _`ESGF Search API`: https://github.com/ESGF/esgf.github.io/wiki/ESGF_Search_REST_API
.. _documentation: http://esgf-pyclient.readthedocs.org
.. _`github`: https://github.com/ESGF/esgf-pyclient
2 changes: 0 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,3 @@ exclude =
old,
build,
dist,
pyesgf/test/test_logon.py,
pyesgf/test/test_opendap.py,
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
url='http://esgf-pyclient.readthedocs.org',
download_url='https://github.com/ESGF/esgf-pyclient',
license='BSD',
packages=find_packages(exclude=['ez_setup', 'examples', 'test']),
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
include_package_data=True,
zip_safe=False,
install_requires=reqs,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions pyesgf/test/test_connection.py → tests/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def test_url_fixing(self):
import warnings
warnings.simplefilter("ignore")
conn1 = SearchConnection(self.test_service)
conn2 = SearchConnection(self.test_service+'/')
conn3 = SearchConnection(self.test_service+'///')
conn4 = SearchConnection(self.test_service+'/search')
conn5 = SearchConnection(self.test_service+'/search///')
conn2 = SearchConnection(self.test_service + '/')
conn3 = SearchConnection(self.test_service + '///')
conn4 = SearchConnection(self.test_service + '/search')
conn5 = SearchConnection(self.test_service + '/search///')
warnings.resetwarnings()

assert conn1.url == conn2.url == conn3.url == conn4.url == conn5.url
Expand Down
5 changes: 5 additions & 0 deletions pyesgf/test/test_context.py → tests/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""

import pytest

from pyesgf.search import SearchConnection, not_equals
from unittest import TestCase
import os
Expand Down Expand Up @@ -91,6 +93,7 @@ def test_facet_count(self):
self.assertTrue(list(counts['model'].keys()) == ['IPSL-CM5A-LR'])
self.assertTrue(list(counts['project'].keys()) == ['CMIP5'])

@pytest.mark.slow
def test_distrib(self):
conn = SearchConnection(self.test_service, distrib=False)

Expand Down Expand Up @@ -160,6 +163,7 @@ def test_negative_facet(self):

assert hits1 == hits2 + hits3

@pytest.mark.slow
def test_replica(self):
# Test that we can exclude replicas
# This tests assumes the test dataset is replicated
Expand Down Expand Up @@ -194,6 +198,7 @@ def test_response_from_bad_parameter(self):
"Invalid query parameter(s): rubbish",
"No JSON object could be decoded"))

@pytest.mark.slow
def test_context_project_cmip6(self):
test_service = 'https://esgf-node.llnl.gov/esg-search'
conn = SearchConnection(test_service)
Expand Down
5 changes: 3 additions & 2 deletions pyesgf/test/test_logon.py → tests/test_logon.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import pytest
from unittest import TestCase
try:
from myproxy.client import MyProxyClient
from myproxy.client import MyProxyClient # noqa: F401
_has_myproxy = True
except (ImportError, SyntaxError):
_has_myproxy = False
Expand Down Expand Up @@ -80,7 +80,8 @@ def test_logon(self, extra_args=None):
_clear_creds(self.esgf_dir)
_load_creds(self.esgf_dir, certificates_tarball='pcmdi9-certs.tar.gz')

if not extra_args: extra_args = {}
if not extra_args:
extra_args = {}
lm = LogonManager(self.esgf_dir, **extra_args)
lm.logon(TEST_USER, TEST_PASSWORD, TEST_MYPROXY)

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion pyesgf/test/test_opendap.py → tests/test_opendap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pyesgf.logon import LogonManager, DAP_CONFIG_MARKER
from pyesgf.search import SearchConnection
try:
from myproxy.client import MyProxyClient
from myproxy.client import MyProxyClient # noqa: F401
_has_myproxy = True
except (ImportError, SyntaxError):
_has_myproxy = False
Expand Down
10 changes: 9 additions & 1 deletion pyesgf/test/test_results.py → tests/test_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def test_file_context(self):

assert f_ctx.facet_constraints['dataset_id'] == r1.dataset_id

@pytest.mark.slow
def test_file_list(self):
conn = SearchConnection(self.test_service, distrib=False)

Expand All @@ -56,6 +57,7 @@ def test_file_list(self):
ds_subpath = ds_id.replace('.', '/')
assert ds_subpath.lower() in download_url.lower()

@pytest.mark.slow
def test_file_list2(self):
conn = SearchConnection(self.test_service, distrib=False)

Expand All @@ -69,6 +71,7 @@ def test_file_list2(self):
for file_result in file_results:
assert re.search(r'ds/.*\.nc', file_result.download_url)

@pytest.mark.slow
def test_gridftp_url_in_file_result(self):
conn = SearchConnection(self.test_service, distrib=False)

Expand All @@ -84,6 +87,7 @@ def test_gridftp_url_in_file_result(self):
assert gridftp_url.split(":")[0] == "gsiftp"
assert file_result.gridftp_url.endswith(".nc")

@pytest.mark.slow
def test_aggregations(self):
conn = SearchConnection(self.test_service, distrib=False)

Expand Down Expand Up @@ -113,6 +117,7 @@ def test_index_node(self):

assert r1.index_node == service.hostname

@pytest.mark.slow
def test_other_index_node(self):
conn = SearchConnection(self.test_service, distrib=True)

Expand All @@ -126,7 +131,7 @@ def test_other_index_node(self):
assert r1.index_node is not None
assert r1.index_node != service.hostname

@pytest.mark.xfail(reason='This test does not work - to be removed?')
@pytest.mark.skip(reason='This test does not work - to be removed?')
def test_shards_constrain(self):
# Test that a file-context constrains the shard list
conn = SearchConnection(self.test_service, distrib=True)
Expand Down Expand Up @@ -156,6 +161,7 @@ def test_shards_constrain(self):
f_r1 = f_results[0]
assert f_r1.json['index_node'] == r1.json['index_node']

@pytest.mark.slow
def test_shards_constrain2(self):
# Regression test for issue #8 reported by ian.edmond@metoffice.gov.uk
conn = SearchConnection(self.test_service_pcmdi, distrib=True)
Expand All @@ -176,6 +182,7 @@ def test_shards_constrain2(self):
for j in searchContext.search():
print((j.download_url, j.checksum, j.checksum_type, j.size))

@pytest.mark.slow
def test_shards_constrain3(self):
# Regression test for issue #8 reported by ian.edmond@metoffice.gov.uk
conn = SearchConnection(self.test_service_pcmdi, distrib=True)
Expand All @@ -195,6 +202,7 @@ def test_shards_constrain3(self):
for j in searchContext.search():
print((j.download_url, j.checksum, j.checksum_type, j.size))

@pytest.mark.slow
def test_shards_constrain4(self):
# Regression test for issue #8 reported by ian.edmond@metoffice.gov.uk
conn = SearchConnection(self.test_service_pcmdi, distrib=True)
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions pyesgf/test/test_util.py → tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"""

import pytest

import re

from pyesgf.search.connection import SearchConnection
Expand All @@ -15,6 +17,7 @@ def setUp(self):
# !TODO: Make this one of the test services.
self.test_service = 'http://esgf-index1.ceda.ac.uk/esg-search'

@pytest.mark.slow
def test_get_manifest(self):
conn = SearchConnection(self.test_service, distrib=False)

Expand Down Expand Up @@ -49,6 +52,7 @@ def test_opendap_url(self):
opendap_url = agg.opendap_url
print(opendap_url)

@pytest.mark.slow
def test_download_url(self):
conn = SearchConnection(self.test_service, distrib=False)

Expand Down
File renamed without changes.

0 comments on commit cf0efe6

Please sign in to comment.