Repository: poliastro/poliastro

Issue:
Fix master
I made a trivial change in master, and some numerical comparisons failed:

https://travis-ci.org/poliastro/poliastro/builds/251342947

I suspect there has been some update in Astropy, but I don't have enough debugging information right now.

Discussion:

Patch:
diff --git a/.gitignore b/.gitignore
index 0fc8784f..eed8783b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,4 @@
-poliastro.nja
+*.nja
 .idea
 .cache
 
@@ -18,3 +18,4 @@ build
 .coverage
 
 __pycache__/
+.eggs/
diff --git a/.travis.yml b/.travis.yml
index e6100c7f..fea35c4b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,6 +25,7 @@ before_install:
   - if [[ "$(uname)" == "Linux" ]]; then wget http://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh; fi
   - bash miniconda.sh -b -p $HOME/miniconda
   - export PATH="$HOME/miniconda/bin:$PATH"
+  - export MPLBACKEND="agg"
 
   # Update conda and create test environment
   - conda config --set always_yes yes --set changeps1 no
@@ -33,23 +34,27 @@ before_install:
   - conda create -q -n test-environment python=$PYTHON
   - source activate test-environment
 
-  # Install project requirements
-  - conda install numpy numba>=0.23 astropy>=1.0 matplotlib scipy jplephem pandoc
-  - pip install coverage pytest pytest-cov codecov pytest-benchmark sphinx sphinx_rtd_theme nbsphinx IPython ipykernel 
+  # Install problematic dependencies
+  - conda install pandoc
 
 install:
-  - pip install --no-deps .  # Test installation correctness
+  - pip install numpy  # Required
+  - pip install .  # Test installation correctness
+  - pip install sphinx sphinx_rtd_theme nbsphinx ipython  # Install documentation dependencies
 
 script:
-  - pytest -vv --benchmark-skip  # Test against installed code
+  - python setup.py test -vv  # Test against installed code
   - sphinx-build -vW -b html docs/source _HTMLTest #Test docs build
+
 after_success:
   # Uninstall to test coverage against sources
   - pip uninstall poliastro -y
-  - pip install --no-deps -e .
+  - pip install -e .
 
-  - NUMBA_DISABLE_JIT=1 pytest --cov --benchmark-skip
+  - NUMBA_DISABLE_JIT=1 python setup.py test --cov
 
+  # Publish coverage
+  - pip install codecov
   - codecov
 
 sudo: false
diff --git a/appveyor.yml b/appveyor.yml
index b91a8310..fe35a536 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -38,11 +38,11 @@ install:
   - "pip install pytest codecov pytest-benchmark sphinx sphinx_rtd_theme nbsphinx IPython ipykernel"
 
   # Install dependencies
-  - "conda install -q numpy numba>=0.23 astropy>=1.0 matplotlib scipy jplephem pandoc"
+  - "conda install -q numpy scipy pandoc"
   - "pip install ."  # Test installation correctness
   
 build: off
 
 test_script:
   - "pytest -vv --benchmark-skip"  # Test against installed code
-  - "sphinx-build -vW -b html docs/source _HTMLTest" # Test docs build
\ No newline at end of file
+  - "sphinx-build -vW -b html docs/source _HTMLTest" # Test docs build
diff --git a/setup.cfg b/setup.cfg
index dfa63cf3..0e1fa302 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -5,4 +5,4 @@ norecursedirs =
     build
 python_files =
     test_*.py
-addopts = --benchmark-autosave
+doctest_plus = disabled
diff --git a/setup.py b/setup.py
index 43d30884..a084e848 100644
--- a/setup.py
+++ b/setup.py
@@ -2,14 +2,30 @@
 # coding: utf-8
 
 # http://stackoverflow.com/a/10975371/554319
+import os
 import io
+import sys
 from setuptools import setup, find_packages
+from setuptools.command.test import test
+
+
+# https://packaging.python.org/guides/single-sourcing-package-version/
+version = {}
+with open(os.path.join("src", "poliastro", "__init__.py")) as fp:
+    exec(fp.read(), version)
+
+
+# https://docs.pytest.org/en/latest/goodpractices.html#manual-integration
+class PyTest(test):
+    def run_tests(self):
+        import pytest
+        sys.exit(pytest.main([]))
 
 
 # http://blog.ionelmc.ro/2014/05/25/python-packaging/
 setup(
     name="poliastro",
-    version='0.7.dev0',
+    version=version['__version__'],
     description="Python package for Orbital Mechanics",
     author="Juan Luis Cano",
     author_email="hello@juanlu.space",
@@ -23,17 +39,20 @@ setup(
     python_requires=">=3.5",
     install_requires=[
         "numpy",
-        "numba>=0.25",
-        "astropy>=1.2",
+        "astropy>=1.2,!=2.0.0",
         "matplotlib",
         "jplephem",
         "scipy",
-        "bs4",
-        "requests"
+        "beautifulsoup4",
+        "requests",
     ],
     tests_require=[
-        "pytest"
+        "coverage",
+        "pytest-cov",
     ],
+    extras_require={
+        'fast': ["numba>=0.25"],
+    },
     packages=find_packages('src'),
     package_dir={'': 'src'},
     entry_points={},
@@ -56,4 +75,5 @@ setup(
     package_data={"poliastro": ['tests/*.py']},
     include_package_data=True,
     zip_safe=False,
+    cmdclass={'test': PyTest},
 )


Test patch:
diff --git a/src/poliastro/tests/test_maneuver.py b/src/poliastro/tests/test_maneuver.py
index ccf6d7ba..4f9c975d 100644
--- a/src/poliastro/tests/test_maneuver.py
+++ b/src/poliastro/tests/test_maneuver.py
@@ -55,9 +55,9 @@ def test_hohmann_maneuver():
 
     man = Maneuver.hohmann(ss_i, Earth.R + alt_f)
 
-    assert_quantity_allclose(ss_i.apply_maneuver(man).ecc, 0 * u.one, atol=1e-15 * u.one)
-    assert_quantity_allclose(man.get_total_cost(), expected_dv, rtol=1e-6)
-    assert_quantity_allclose(man.get_total_time(), expected_t_trans, rtol=1e-6)
+    assert_quantity_allclose(ss_i.apply_maneuver(man).ecc, 0 * u.one, atol=1e-14 * u.one)
+    assert_quantity_allclose(man.get_total_cost(), expected_dv, rtol=1e-5)
+    assert_quantity_allclose(man.get_total_time(), expected_t_trans, rtol=1e-5)
 
 
 def test_bielliptic_maneuver():
@@ -72,5 +72,5 @@ def test_bielliptic_maneuver():
     man = Maneuver.bielliptic(ss_i, Earth.R + alt_b, Earth.R + alt_f)
 
     assert_allclose(ss_i.apply_maneuver(man).ecc, 0 * u.one, atol=1e-12 * u.one)
-    assert_quantity_allclose(man.get_total_cost(), expected_dv, rtol=1e-6)
+    assert_quantity_allclose(man.get_total_cost(), expected_dv, rtol=1e-5)
     assert_quantity_allclose(man.get_total_time(), expected_t_trans, rtol=1e-6)