mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
pythonPackages.astroquery: add checkPhase
This commit is contained in:
parent
93a6bba94e
commit
1354a2e642
2 changed files with 77 additions and 2 deletions
|
@ -0,0 +1,54 @@
|
||||||
|
diff -ruN astroquery-0.3.9.orig/astroquery/conftest.py astroquery-0.3.9/astroquery/conftest.py
|
||||||
|
--- astroquery-0.3.9.orig/astroquery/conftest.py 2018-11-27 14:51:16.000000000 +0100
|
||||||
|
+++ astroquery-0.3.9/astroquery/conftest.py 2019-07-23 18:19:17.000000000 +0200
|
||||||
|
@@ -5,15 +5,20 @@
|
||||||
|
# by importing them here in conftest.py they are discoverable by py.test
|
||||||
|
# no matter how it is invoked within the source tree.
|
||||||
|
|
||||||
|
-from astropy.tests.pytest_plugins import (PYTEST_HEADER_MODULES,
|
||||||
|
- enable_deprecations_as_exceptions,
|
||||||
|
- TESTED_VERSIONS)
|
||||||
|
+from astropy.version import version as astropy_version
|
||||||
|
|
||||||
|
-try:
|
||||||
|
- packagename = os.path.basename(os.path.dirname(__file__))
|
||||||
|
- TESTED_VERSIONS[packagename] = version.version
|
||||||
|
-except NameError:
|
||||||
|
- pass
|
||||||
|
+if astropy_version < '3.0':
|
||||||
|
+ # With older versions of Astropy, we actually need to import the pytest
|
||||||
|
+ # plugins themselves in order to make them discoverable by pytest.
|
||||||
|
+ from astropy.tests.pytest_plugins import *
|
||||||
|
+else:
|
||||||
|
+ # As of Astropy 3.0, the pytest plugins provided by Astropy are
|
||||||
|
+ # automatically made available when Astropy is installed. This means it's
|
||||||
|
+ # not necessary to import them here, but we still need to import global
|
||||||
|
+ # variables that are used for configuration.
|
||||||
|
+ from astropy.tests.plugins.display import PYTEST_HEADER_MODULES, TESTED_VERSIONS
|
||||||
|
+
|
||||||
|
+from astropy.tests.helper import enable_deprecations_as_exceptions
|
||||||
|
|
||||||
|
# Add astropy to test header information and remove unused packages.
|
||||||
|
# Pytest header customisation was introduced in astropy 1.0.
|
||||||
|
@@ -36,12 +41,17 @@
|
||||||
|
# The warnings_to_ignore_by_pyver parameter was added in astropy 2.0
|
||||||
|
enable_deprecations_as_exceptions(modules_to_ignore_on_import=['requests'])
|
||||||
|
|
||||||
|
+# add '_testrun' to the version name so that the user-agent indicates that
|
||||||
|
+# it's being run in a test
|
||||||
|
+from . import version
|
||||||
|
+version.version += '_testrun'
|
||||||
|
+
|
||||||
|
+
|
||||||
|
# This is to figure out the affiliated package version, rather than
|
||||||
|
# using Astropy's
|
||||||
|
-try:
|
||||||
|
- from .version import version
|
||||||
|
-except ImportError:
|
||||||
|
- version = 'dev'
|
||||||
|
+from .version import version, astropy_helpers_version
|
||||||
|
+
|
||||||
|
|
||||||
|
packagename = os.path.basename(os.path.dirname(__file__))
|
||||||
|
TESTED_VERSIONS[packagename] = version
|
||||||
|
+TESTED_VERSIONS['astropy_helpers'] = astropy_helpers_version
|
|
@ -6,21 +6,42 @@
|
||||||
, keyring
|
, keyring
|
||||||
, beautifulsoup4
|
, beautifulsoup4
|
||||||
, html5lib
|
, html5lib
|
||||||
|
, pytest
|
||||||
|
, pytest-astropy
|
||||||
|
, astropy-helpers
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
pname = "astroquery";
|
pname = "astroquery";
|
||||||
version = "0.3.9";
|
version = "0.3.9";
|
||||||
|
|
||||||
doCheck = false; # Tests require the pytest-astropy package
|
|
||||||
|
|
||||||
src = fetchPypi {
|
src = fetchPypi {
|
||||||
inherit pname version;
|
inherit pname version;
|
||||||
sha256 = "0zw3xp2rfc6h2v569iqsyvzhfnzp7bfjb7jrj61is1hrqw1cqjrb";
|
sha256 = "0zw3xp2rfc6h2v569iqsyvzhfnzp7bfjb7jrj61is1hrqw1cqjrb";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# Fix tests using conftest.py from HEAD in the upstream GitHub
|
||||||
|
# repository.
|
||||||
|
patches = [ ./conftest-astropy-3-fix.patch ];
|
||||||
|
|
||||||
propagatedBuildInputs = [ astropy requests keyring beautifulsoup4 html5lib ];
|
propagatedBuildInputs = [ astropy requests keyring beautifulsoup4 html5lib ];
|
||||||
|
|
||||||
|
nativeBuildInputs = [ astropy-helpers ];
|
||||||
|
|
||||||
|
checkInputs = [ pytest pytest-astropy ];
|
||||||
|
|
||||||
|
# Disable automatic update of the astropy-helper module
|
||||||
|
postPatch = ''
|
||||||
|
substituteInPlace setup.cfg --replace "auto_use = True" "auto_use = False"
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Tests must be run in the build directory. The tests create files
|
||||||
|
# in $HOME/.astropy so we need to set HOME to $TMPDIR.
|
||||||
|
checkPhase = ''
|
||||||
|
cd build/lib
|
||||||
|
HOME=$TMPDIR pytest
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with pkgs.lib; {
|
meta = with pkgs.lib; {
|
||||||
description = "Functions and classes to access online data resources";
|
description = "Functions and classes to access online data resources";
|
||||||
homepage = "https://astroquery.readthedocs.io/";
|
homepage = "https://astroquery.readthedocs.io/";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue