diff --git a/python-tldextract.changes b/python-tldextract.changes index 6abe569..9567c17 100644 --- a/python-tldextract.changes +++ b/python-tldextract.changes @@ -1,6 +1,10 @@ ------------------------------------------------------------------- Sun Mar 10 19:57:13 UTC 2019 - Martin Herkt <9+suse@cirno.systems> +- Run test suite +- Add tldextract-tests-offline.patch + No internet connection on OBS build hosts; skip suffix list + snapshot diff - Update to 2.2.1 * Bugfixes - Ignore case on punycode prefix check diff --git a/python-tldextract.spec b/python-tldextract.spec index 744f562..5294547 100644 --- a/python-tldextract.spec +++ b/python-tldextract.spec @@ -26,6 +26,15 @@ Group: Development/Languages/Python Url: https://github.com/john-kurkowski/tldextract Source: https://files.pythonhosted.org/packages/source/t/tldextract/tldextract-%{version}.tar.gz Source1: %{name}-rpmlintrc +# No internet connection on OBS build hosts; skip suffix list snapshot diff +Patch: tldextract-tests-offline.patch +### BEGIN test requirements +BuildRequires: %{python_module pytest-mock} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests-file} >= 1.4 +BuildRequires: %{python_module requests} >= 2.1.0 +BuildRequires: %{python_module responses} +### END test requirements BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -46,6 +55,7 @@ as well. %prep %setup -q -n tldextract-%{version} +%autopatch -p1 %build %python_build @@ -54,6 +64,10 @@ as well. %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} +%check +%python_exec setup.py develop --user +%python_exec -m pytest -v tests + %files %{python_files} %license LICENSE %doc README.md diff --git a/tldextract-tests-offline.patch b/tldextract-tests-offline.patch new file mode 100644 index 0000000..132f474 --- /dev/null +++ b/tldextract-tests-offline.patch @@ -0,0 +1,28 @@ +diff -ru tldextract-2.2.1.orig/tests/integration_test.py tldextract-2.2.1/tests/integration_test.py +--- tldextract-2.2.1.orig/tests/integration_test.py 2016-04-04 04:11:18.000000000 +0200 ++++ tldextract-2.2.1/tests/integration_test.py 2019-03-10 21:25:34.201039604 +0100 +@@ -8,24 +8,6 @@ + + import tldextract + +- +-def test_log_snapshot_diff(mocker): +- mocker.patch.object(logging.getLogger(), 'level', logging.DEBUG) +- debug_mock = mocker.patch.object(logging.getLogger('tldextract'), 'debug') +- +- extractor = tldextract.TLDExtract() +- try: +- os.remove(extractor.cache_file) +- except (IOError, OSError): +- logging.warning(traceback.format_exc()) +- +- extractor('ignore.com') +- +- assert debug_mock.call_count == 1 +- log_str = debug_mock.call_args[0][0] +- assert log_str.startswith('computed TLD diff') +- +- + def test_bad_kwargs(): + with pytest.raises(ValueError): + tldextract.TLDExtract(