diff --git a/docs/install.rst b/docs/install.rst
index 6d8fc4d1..7063334d 100644
--- a/docs/install.rst
+++ b/docs/install.rst
@@ -5,28 +5,34 @@ Installation
Requirements
^^^^^^^^^^^^
-`sbpy` has the following requirements that will be automatically taken
-care of with installation using pip:
+`sbpy` has the following requirements that will be automatically taken care of
+with installation using pip:
* Python 3.6 or later
* `numpy `__ 1.16.0 or later
* pytest 3.1 or later
* `astropy `__
-* `astroquery `__ 0.4.1.dev5892 or later: For retrieval of online data, e.g., ephemerides and orbits.
-* `scipy `__: For numerical integrations in `sbpy.activity.gas` and `sbpy.photometry`, among others.
-* `synphot `__ 0.1.3 or later: For calibration with respect to the Sun and Vega, filtering spectra through bandpasses.
-
-The following packages will have to be installed manually, if the user
-wants to use them:
-
-* `oorb `__: For
- orbit transformations (`~sbpy.data.Orbit.oo_transform`) and
- propagations (`~sbpy.data.Orbit.oo_propagate`), as well as
- ephemerides calculations (`~sbpy.data.Ephem.from_oo`).
-* `pyradex `__: For non-LTE
- production rate calculation related to cometary activity
- (`~sbpy.activity.gas.NonLTE`).
-* `ginga `__ and `photutils `__: To interactively enhance images of comets with the `~sbpy.imageanalysis.CometaryEnhancement` Ginga plugin.
+* `astroquery `__ 0.4.1.dev5892 or
+ later: For retrieval of online data, e.g., ephemerides and orbits.
+* `scipy `__: For numerical integrations in
+ `sbpy.activity.gas` and `sbpy.photometry`, among others.
+* `synphot `__ 0.1.3 or
+ later: For calibration with respect to the Sun and Vega, filtering spectra
+ through bandpasses.
+
+The following packages will have to be installed manually, if the user wants to
+use them:
+
+* `oorb `__: For orbit
+ transformations (`~sbpy.data.Orbit.oo_transform`) and propagations
+ (`~sbpy.data.Orbit.oo_propagate`), as well as ephemerides calculations
+ (`~sbpy.data.Ephem.from_oo`).
+* `pyradex `__: For non-LTE production
+ rate calculation related to cometary activity (`~sbpy.activity.gas.NonLTE`).
+* `ginga `__ and `photutils
+ `__: To interactively enhance
+ images of comets with the `~sbpy.imageanalysis.CometaryEnhancement` Ginga
+ plugin.
Using pip
@@ -49,9 +55,9 @@ The latest development version of `sbpy` can be easily installed using
Using GitHub
^^^^^^^^^^^^
-This way of installing `sbpy` is recommended if you plan to contribute
-to the module. The current development version of `sbpy` can be
-obtained from `GitHub `__ using
+This way of installing `sbpy` is recommended if you plan to contribute to the
+module. The current development version of `sbpy` can be obtained from `GitHub
+`__ using
.. code-block:: bash
@@ -63,9 +69,41 @@ This will create a new directory (``sbpy/``). In this directory, run
$ python setup.py install --user
-in order to use `sbpy` in your default Python environment. If you plan to work on the code and always want to use the latest version of your code, you can install it with
+in order to use `sbpy` in your default Python environment. If you plan to work
+on the code and always want to use the latest version of your code, you can
+install it with
.. code-block:: bash
$ python setup.py develop --user
+
+
+Running tests
+^^^^^^^^^^^^^
+
+To verify your installation is properly working, run `sbpy`'s testing suite.
+
+First, install the required testing packages by using the "test" option, e.g.,
+`sbpy[test]`:
+
+.. code-block:: bash
+
+ # for testing a stable package
+ $ pip install sbpy[test]
+
+ # for testing a development packge from a GitHub
+ $ pip install sbpy[test]@git+https://github.com/NASA-Planetary-Science/sbpy.git
+
+Next, test with pytest:
+
+.. code-block:: bash
+
+ $ pytest --pyargs sbpy
+
+Add the `--remote-data` option to aslo run tests that require a network
+connection, and `-m "not slow"` to skip any tests marked as slow.
+
+It is recommended that developers use `tox` for testing in order to use
+controlled environments. See the ``astropy` testing guidelines
+`__ for more.
\ No newline at end of file
diff --git a/sbpy/activity/gas/tests/test_core.py b/sbpy/activity/gas/tests/test_core.py
index 8a6bdff7..1ae812e7 100644
--- a/sbpy/activity/gas/tests/test_core.py
+++ b/sbpy/activity/gas/tests/test_core.py
@@ -127,9 +127,11 @@ def test_column_density_small_angular_aperture(self):
eph = dict(delta=1 * u.au)
parent = 1e4 * u.km
N_avg = 2 * Haser(Q, v, parent).column_density(rho, eph)
- rho_km = (rho * eph['delta'] * 725.24 * u.km / u.arcsec / u.au).to('km')
+ rho_km = (rho * eph['delta'] * 725.24 *
+ u.km / u.arcsec / u.au).to('km')
ideal = Q / v / 2 / rho_km
- assert np.isclose(N_avg.to_value('1/m2'), ideal.to_value('1/m2'), rtol=0.001)
+ assert np.isclose(N_avg.to_value('1/m2'),
+ ideal.to_value('1/m2'), rtol=0.001)
def test_column_density(self):
"""
@@ -412,12 +414,12 @@ def test_grid_count(self):
'tau_d': 101730 * u.s,
'v_outflow': 1 * u.km/u.s,
'sigma': 3e-16 * u.cm**2
- })
+ })
# Fragment molecule is OH
fragment = Phys.from_dict({
'tau_T': photo_timescale('OH') * 0.93,
'v_photo': 1.05 * u.km/u.s
- })
+ })
coma = VectorialModel(base_q=base_q,
parent=parent,
@@ -441,21 +443,23 @@ def test_total_number_large_aperture(self):
'tau_d': 101730 * u.s,
'v_outflow': 1 * u.km/u.s,
'sigma': 3e-16 * u.cm**2
- })
+ })
# Fragment molecule is OH
fragment = Phys.from_dict({
'tau_T': photo_timescale('OH') * 0.93,
'v_photo': 1.05 * u.km/u.s
- })
+ })
coma = VectorialModel(base_q=base_q,
parent=parent,
fragment=fragment)
fragment_theory = coma.vmodel['num_fragments_theory']
- ap = core.CircularAperture((coma.vmodel['max_grid_radius'].value) * u.m)
+ ap = core.CircularAperture(
+ (coma.vmodel['max_grid_radius'].value) * u.m)
assert np.isclose(fragment_theory, coma.total_number(ap), rtol=0.02)
+ @pytest.mark.slow
def test_model_symmetry(self):
"""
The symmetry of the model allows the parent production to be
@@ -486,12 +490,12 @@ def test_model_symmetry(self):
'tau_d': 101730 * u.s,
'v_outflow': 1 * u.km/u.s,
'sigma': 3e-16 * u.cm**2
- })
+ })
# Fragment molecule is OH
fragment = Phys.from_dict({
'tau_T': photo_timescale('OH') * 0.93,
'v_photo': 1.05 * u.km/u.s
- })
+ })
coma = VectorialModel(base_q=base_production*(1/u.s),
parent=parent,
@@ -508,12 +512,12 @@ def test_model_symmetry(self):
'tau_d': 101730 * u.s,
'v_outflow': 1 * u.km/u.s,
'sigma': 3e-16 * u.cm**2
- })
+ })
# Fragment molecule is OH
fragment_check = Phys.from_dict({
'tau_T': photo_timescale('OH') * 0.93,
'v_photo': 1.05 * u.km/u.s
- })
+ })
coma_check = VectorialModel(base_q=calculated_q*(1/u.s),
parent=parent_check,
fragment=fragment_check)
diff --git a/sbpy/activity/gas/tests/test_prodrate_remote.py b/sbpy/activity/gas/tests/test_prodrate_remote.py
index 4f0c585e..7401a8f8 100644
--- a/sbpy/activity/gas/tests/test_prodrate_remote.py
+++ b/sbpy/activity/gas/tests/test_prodrate_remote.py
@@ -64,6 +64,7 @@ def data_path(filename):
return os.path.join(data_dir, filename)
+@pytest.mark.slow
@remote_data
def test_remote_prodrate_simple_hcn():
@@ -151,9 +152,7 @@ def test_remote_prodrate_simple_ch3oh():
assert np.all(err < 0.35)
-# Issue #296
-# MSK: disabling test as CO and HCN are no longer present in LAMDA database(?)
-@pytest.mark.skip
+@pytest.mark.slow
@remote_data
def test_einstein():
@@ -184,7 +183,7 @@ def test_einstein():
mol_name = mol['NAME'].data[0]
- lam_search = Lamda.query(mol=mol_name.lower())
+ lam_search = Lamda().query(mol=mol_name.lower())
lam_result = lam_search[1]
diff --git a/sbpy/conftest.py b/sbpy/conftest.py
index c570fcc6..c2f4ceca 100644
--- a/sbpy/conftest.py
+++ b/sbpy/conftest.py
@@ -9,6 +9,7 @@
import os
+import pytest
from astropy.version import version as astropy_version
# For Astropy 3.0 and later, we can use the standalone pytest plugin
@@ -48,6 +49,11 @@ def pytest_configure(config):
packagename = os.path.basename(os.path.dirname(__file__))
TESTED_VERSIONS[packagename] = __version__
+ config.addinivalue_line(
+ "markers",
+ "slow: marks tests as slow (deselect with '-m \"not slow\"')"
+ )
+
# Uncomment the last two lines in this block to treat all DeprecationWarnings
# as exceptions. For Astropy v2.0 or later, there are 2 additional keywords,
# as follow (although default should work for most cases).
diff --git a/sbpy/data/tests/test_obs_remote.py b/sbpy/data/tests/test_obs_remote.py
index 50c35ab8..d0c8c0dc 100644
--- a/sbpy/data/tests/test_obs_remote.py
+++ b/sbpy/data/tests/test_obs_remote.py
@@ -14,6 +14,7 @@
@pytest.mark.remote_data
class TestObsfromMPC:
+ @pytest.mark.slow
def test_simple(self):
# asteroid
data = Obs.from_mpc('12893')