From 387c0d93a06bcc7b6b2502fcb4cfce8c2d4816a4 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Fri, 18 Oct 2019 11:57:20 +0200 Subject: [PATCH] Add project release config and use Travis build stages. Refs #378. --- .travis.yml | 50 ++++++++++++++++++++++----------- setup.py | 14 ++------- tablib/packages/dbfpy/dbf.py | 8 +++--- tablib/packages/dbfpy/dbfnew.py | 12 ++++---- tablib/packages/dbfpy3/dbf.py | 5 ++-- tox.ini | 7 +++-- 6 files changed, 52 insertions(+), 44 deletions(-) diff --git a/.travis.yml b/.travis.yml index 79a51758..ed1986f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,36 @@ +sudo: false language: python +python: +- 2.7 +- 3.6 +- 3.7 +- 3.8-dev cache: pip - -matrix: +dist: xenial +install: travis_retry pip install tox-travis +script: echo "Running tests against $(python --version) ..." +stages: +- test +- name: deploy + if: repo = jazzband/tablib AND tag IS present +jobs: include: - - python: 2.7 - - python: 3.5 - - python: 3.6 - - python: 3.7 - - python: 3.8-dev - -install: - - pip install -r requirements.txt - - pip install -U pytest pytest-cov - -script: pytest --cov tablib - -after_success: - - pip install -U codecov - - codecov + - stage: test + script: tox + after_success: + - pip install -U codecov + - codecov + - stage: deploy + install: skip + script: skip + python: 3.7 + deploy: + provider: pypi + user: jazzband + server: https://jazzband.co/projects/tablib/upload + distributions: sdist bdist_wheel + password: + secure: svV4fYtodwW+iTyFOm5ISEfhVwcA+6vTskD3x6peznc40TdMV9Ek8nT3Q/NB4lCbXoUw2qR4H6uhLCjesnv/VvVk/qbitCyD8ySlgwOV5n7NzJs8lC8EYaHSjGQjatTwJAokfGVYkPawkI7HXDqtDggLUQBK+Ag8HDW+XBSbQIU= + on: + tags: true + repo: jazzband/tablib diff --git a/setup.py b/setup.py index 0ec96599..263085b5 100755 --- a/setup.py +++ b/setup.py @@ -13,18 +13,9 @@ sys.exit() -if sys.argv[-1] == 'test': - try: - __import__('py') - except ImportError: - print('py.test required.') - sys.exit(1) - - errors = os.system('py.test test_tablib.py') - sys.exit(bool(errors)) - packages = [ - 'tablib', 'tablib.formats', + 'tablib', + 'tablib.formats', 'tablib.packages', 'tablib.packages.dbfpy', 'tablib.packages.dbfpy3' @@ -71,7 +62,6 @@ 'Programming Language :: Python :: 3.7', ], python_requires='>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*', - tests_require=['pytest'], install_requires=install, extras_require={ 'pandas': ['pandas'], diff --git a/tablib/packages/dbfpy/dbf.py b/tablib/packages/dbfpy/dbf.py index add74da0..8147d0e7 100644 --- a/tablib/packages/dbfpy/dbf.py +++ b/tablib/packages/dbfpy/dbf.py @@ -31,9 +31,9 @@ dbf = Dbf(filename, True) for rec in dbf: for fldName in dbf.fieldNames: - print '%s:\t %s (%s)' % (fldName, rec[fldName], - type(rec[fldName])) - print + print('%s:\t %s (%s)' % (fldName, rec[fldName], + type(rec[fldName]))) + print() dbf.close() """ @@ -258,7 +258,7 @@ def __setitem__(self, index, record): def demo_read(filename): _dbf = Dbf(filename, True) for _rec in _dbf: - print + print() print(repr(_rec)) _dbf.close() diff --git a/tablib/packages/dbfpy/dbfnew.py b/tablib/packages/dbfpy/dbfnew.py index 7a06d001..008d3077 100644 --- a/tablib/packages/dbfpy/dbfnew.py +++ b/tablib/packages/dbfpy/dbfnew.py @@ -160,9 +160,9 @@ def write_stream(self, stream): dbfn.add_field("date", 'D', 8) dbfn.write("tst.dbf") # test new dbf - print "*** created tst.dbf: ***" + print("*** created tst.dbf: ***") dbft = Dbf('tst.dbf', readOnly=0) - print repr(dbft) + print(repr(dbft)) # add a record rec = DbfRecord(dbft) rec['name'] = 'something' @@ -177,13 +177,13 @@ def write_stream(self, stream): rec.store() # show the records - print "*** inserted 2 records into tst.dbf: ***" - print repr(dbft) + print("*** inserted 2 records into tst.dbf: ***") + print(repr(dbft)) for i1 in range(len(dbft)): rec = dbft[i1] for fldName in dbft.fieldNames: - print '%s:\t %s' % (fldName, rec[fldName]) - print + print('%s:\t %s' % (fldName, rec[fldName])) + print() dbft.close() # vim: set et sts=4 sw=4 : diff --git a/tablib/packages/dbfpy3/dbf.py b/tablib/packages/dbfpy3/dbf.py index 6fee4574..218353e1 100644 --- a/tablib/packages/dbfpy3/dbf.py +++ b/tablib/packages/dbfpy3/dbf.py @@ -31,9 +31,8 @@ dbf = Dbf(filename, True) for rec in dbf: for fldName in dbf.fieldNames: - print '%s:\t %s (%s)' % (fldName, rec[fldName], - type(rec[fldName])) - print + print('%s:\t %s (%s)' % (fldName, rec[fldName], + type(rec[fldName]))) dbf.close() """ diff --git a/tox.ini b/tox.ini index 0a954c48..9c017412 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,9 @@ minversion = 2.4 envlist = py27, py35, py36, py37 [testenv] -deps = pytest +deps = + pytest + pytest-cov + -rrequirements.txt extras = pandas -commands = python setup.py test +commands = pytest --cov tablib