Added basic tests, via tox and CI via Travis
This commit is contained in:
parent
2c715b5bea
commit
94225ce126
|
@ -3,3 +3,4 @@ build/
|
|||
*.egg-info/
|
||||
__pycache__/
|
||||
venv/
|
||||
.tox/
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
sudo: false
|
||||
dist: xenial
|
||||
language: python
|
||||
install:
|
||||
- pip install tox
|
||||
|
||||
script:
|
||||
- tox -e $TOXENV
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
# Python version is just for the look on travis.
|
||||
- python: 2.7
|
||||
env: TOXENV=py27
|
||||
|
||||
- python: 3.5
|
||||
env: TOXENV=py35
|
||||
|
||||
- python: 3.6
|
||||
env: TOXENV=py36
|
||||
|
||||
- python: 3.7
|
||||
env: TOXENV=py37
|
||||
sudo: true
|
|
@ -5,6 +5,8 @@
|
|||
* Added a ``--check-only`` argument to ``download.py`` to display the expiration dates of the files currently on disk.
|
||||
* Enable computation of the expiration date of the BSP file(s) on disk (requires to install the local repository using the [dev] option / See README for more information).
|
||||
* Dropped compatibility with Python 3.3 and 3.4, as skyfield did.
|
||||
* Added basic tests for the ``get_skyfield_data_path`` function using `tox`.
|
||||
* Added automated tests through Travis CI.
|
||||
|
||||
## 0.0.2 (2019-08-23)
|
||||
|
||||
|
|
6
Makefile
6
Makefile
|
@ -6,7 +6,8 @@ help:
|
|||
@echo " * clean: remove all skyfield data from data directory."
|
||||
@echo " * package: build python source package."
|
||||
@echo ""
|
||||
@echo " * install-dev: Install the requirements to execute download.py"
|
||||
@echo " * install-dev: Install the requirements to switch to dev mode."
|
||||
@echo " * test: Run tests using tox."
|
||||
|
||||
download:
|
||||
python3 download.py
|
||||
|
@ -19,3 +20,6 @@ package:
|
|||
|
||||
install-dev:
|
||||
pip install -e .[dev]
|
||||
|
||||
test:
|
||||
tox
|
||||
|
|
|
@ -36,6 +36,12 @@ setup_requires =
|
|||
dev =
|
||||
jplephem
|
||||
numpy
|
||||
tox
|
||||
tests =
|
||||
pytest
|
||||
skyfield
|
||||
mock
|
||||
# ipdb
|
||||
|
||||
[bdist_wheel]
|
||||
universal = 1
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
import mock
|
||||
from skyfield_data import get_skyfield_data_path
|
||||
from skyfield.api import Loader
|
||||
|
||||
|
||||
def test_load_no_cache(tmpdir):
|
||||
with mock.patch('jplephem.spk.SPK.open'): # avoid naughty side-effects
|
||||
with mock.patch('skyfield.iokit.download') as download_patched:
|
||||
load = Loader(tmpdir.dirname)
|
||||
load('de421.bsp')
|
||||
assert download_patched.call_count == 1
|
||||
|
||||
|
||||
@mock.patch('skyfield.iokit.download')
|
||||
def test_load_using_cache(download_patched):
|
||||
load = Loader(get_skyfield_data_path())
|
||||
load('de421.bsp')
|
||||
assert download_patched.call_count == 0
|
Loading…
Reference in New Issue