Skip to content

Commit

Permalink
Remove tox
Browse files Browse the repository at this point in the history
Bump package version
Use coverage with pytest
Change supported Python versions
Add test_data.py with data tests
  • Loading branch information
yaph committed Nov 2, 2021
1 parent 64b7ee3 commit f9b0845
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 40 deletions.
7 changes: 3 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
# command to install dependencies
install:
- pip install .
# command to run tests
script: python setup.py test
script: pytest
# only notify when status changes from success to failure
notifications:
email:
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2019 by Ramiro Gómez (https://ramiro.org/)
Copyright (C) 2021 by Ramiro Gómez (https://ramiro.org/)

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
12 changes: 4 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ help:
@echo "clean-test - remove test and coverage artifacts"
@echo "dist - package"
@echo "test - run tests quickly with the default Python"
@echo "test-all - run tests on every Python version with tox"
@echo "release - package and upload a release"


Expand Down Expand Up @@ -47,7 +46,6 @@ clean-pyc:
find . -name '__pycache__' -exec rm -fr {} +

clean-test:
rm -fr .tox/
rm -f .coverage
rm -fr htmlcov/

Expand All @@ -59,14 +57,12 @@ install: clean
pip install -r requirements.txt --use-mirrors
python setup.py install

# Call example: make release version=1.2.0
release: clean dist
# Call example: make release version=1.3.0
release: test dist
git tag -a $(version) -m 'Create version $(version)'
git push --tags
twine upload dist/*

test:
python setup.py test

test-all:
tox
coverage run --source geonamescache -m pytest
coverage report
11 changes: 1 addition & 10 deletions geonamescache/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
# -*- coding: utf-8 -*-
"""
geonamescache
=============
:copyright: (c) 2018 by Ramiro Gómez.
:license: ISC, see LICENSE for more details.
"""

__title__ = 'geonamescache'
__version__ = '1.2.0'
__version__ = '1.3.0'
__author__ = 'Ramiro Gómez'
__license__ = 'MIT'

Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ flake8
ipython
ipdb
pytest
tox
twine
wheel
7 changes: 3 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Software Development :: Libraries :: Python Modules'
],
test_suite='tests',
tests_require=['tox'],
tests_require=['pytest'],
)
21 changes: 21 additions & 0 deletions tests/test_data.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
from geonamescache import GeonamesCache


geonamescache = GeonamesCache()


def test_cities_len():
# Make sure there are more than 25000 cities
assert 25000 < len(geonamescache.get_cities())


def test_cities_len():
# Make sure there are more than 250 countries
assert 250 < len(geonamescache.get_countries())


def test_us_counties_len():
# Make sure there are 3235 counties, which includes Puerto Rico etc.
us_counties = geonamescache.get_us_counties()
assert 3234 == len(us_counties)
5 changes: 0 additions & 5 deletions tests/test_geonamescache.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,6 @@ def test_search_cities_case_sensitive_with_casefold(self):
cities = self.geonamescache.search_cities('Giessen', attribute='name', case_sensitive=False)
self.assertGreaterEqual(len(cities), 1 if hasattr('', 'casefold') else 0)

def test_us_counties_len(self):
# Make sure there are 3235 counties, which includes Puerto Rico etc.
us_counties = self.geonamescache.get_us_counties()
self.assertEqual(3234, len(us_counties))


if __name__ == '__main__':
unittest.main()
7 changes: 0 additions & 7 deletions tox.ini

This file was deleted.

0 comments on commit f9b0845

Please sign in to comment.