Skip to content

Commit 4782592

Browse files
authored
Merge pull request #81 from nicoddemus/auto-deploy
Implement autodeploy using Travis (now from fork)
2 parents d2f8ae1 + 73d96ca commit 4782592

File tree

10 files changed

+75
-95
lines changed

10 files changed

+75
-95
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ htmlcov/
1717
.tox/
1818
.coverage
1919
.coverage.*
20-
.cache
20+
.pytest_cache/
21+
.eggs/
2122
coverage.xml
2223
tests/junit.xml
24+
25+
pytest_flask/_version.py

.travis.yml

Lines changed: 38 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,48 @@
11
language: python
22

3-
branches:
4-
except:
5-
- gh-pages
6-
7-
cache:
8-
directories:
9-
- "${HOME}/virtualenv"
10-
- "${TRAVIS_BUILD_DIR}/.tox"
11-
123
python:
13-
- 2.6
14-
- 2.7
15-
- 3.3
16-
- 3.4
17-
- 3.5
18-
- 3.6
19-
- pypy
4+
- "3.6"
5+
6+
stages:
7+
- test
8+
- name: deploy
9+
if: repo = pytest-dev/pytest-flask AND tag IS present
10+
11+
jobs:
12+
include:
13+
- env: TOXENV=py27
14+
python: '2.7'
15+
- env: TOXENV=py34
16+
python: '3.4'
17+
- env: TOXENV=py35
18+
python: '3.5'
19+
- env: TOXENV=py36
20+
python: '3.6'
21+
- env: TOXENV=py37
22+
python: '3.7'
23+
sudo: required
24+
dist: xenial
2025

21-
matrix:
22-
fast_finish: true
23-
allow_failures:
24-
- python: 3.6
25-
- python: 3.5
26+
- stage: deploy
27+
python: '3.6'
28+
env:
29+
install: pip install -U setuptools setuptools_scm
30+
script: skip
31+
deploy:
32+
provider: pypi
33+
user: nicoddemus
34+
distributions: sdist bdist_wheel
35+
skip_upload_docs: true
36+
password:
37+
secure: lSaCqdifJoDS7qjpAnGgfrvuACEEBBQYDsjtkNlkktIhrZNJi0OjNWNuHN8uDpQSULiOdiQv/bOCAk288Pao341nHznMP3Cu9o+Zgi96dESAwTHx7w+01uzj+nzuRieeYL+Ye9VK0W3A7yu8tTG2GAhuqKCv0bDV7fUKAfySSI+SKTudLt4DHAYLd02tpbmPoHcHRqUSKTtkJKYUaYGM9QGk8p4+2ap006nqiykhiplnAWNLu+xzby7TaFYpA3Yy4x6XWMcdOoTaaBzQHZaGVayT1zR1BfmcOovlIb8sOUQVr6PV/dxC29VTRuyY85S2Rdyw/2Y4viTO5c1omEU/pVzy4RNi4RWboh58WA0kjrwOmb/nLW8AcXNJG9H828dqy8KKdbblTU5guz1oO1Tb2ICLT2z4hQOcZoDkCg3jf54Ee4BYvLOvMH/kNOjNqLA7wjBUzvyWk5OPOIPZ0rozmRwU89VS2kxIhbvtAq0BtmLnIYY3nT5BIrt18FomiINxlgZj6jz2uWGaOPAhcghdjydbGdYs5g2JcUc1B3jvXSyjB+o1l/EJ9OUwCQWIc32XWvOtx/a7pcyrejbKBqQqi5nKF1bvYDM+8VSLEeLTIX1Ie8hModxWp8WPIk+dHBdy8Kb91c4ssOvEkfwHK7cYBdbcn6O0yhiLOxuOO/3Cb3c=
38+
on:
39+
tags: true
40+
repo: pytest-dev/pytest-flask
2641

2742
install:
28-
- pip install tox
29-
- pip install tox-travis
43+
- pip install -U pip
44+
- pip install -U tox setuptools
3045

3146
script:
3247
- tox
33-
- "find ${TRAVIS_BUILD_DIR}/.tox -name log -o -name __pycache__ -type d | xargs -I {} rm -rf {}"
3448

HOWTORELEASE.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Here are the steps on how to make a new release.
2+
3+
1. Create a ``release-VERSION`` branch from ``upstream/master``.
4+
2. Update ``docs/changelog.rst``.
5+
3. Push a branch with the changes.
6+
4. Once all builds pass, push a tag to ``upstream``.
7+
5. Merge the PR.

MANIFEST.in

Lines changed: 0 additions & 8 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 20 deletions
This file was deleted.

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Changelog
66
Upcoming release
77
-----------------
88

9+
- Implement deployment using Travis, following in line with many other pytest plugins.
10+
911
- Allow live server to handle concurrent requests (`#56`_), thanks to
1012
`@mattwbarry`_ for the PR.
1113

pytest_flask/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
33

4-
__version__ = "0.10.0"
4+
from ._version import version as __version__

setup.py

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
pytest-flask
55
============
66
7-
A set of `pytest <http://pytest.org>`_ fixtures to test Flask
7+
A set of `pytest <https://docs.pytest.org>`_ fixtures to test Flask
88
extensions and applications.
99
1010
Features
@@ -117,16 +117,6 @@ def read(*parts):
117117
return ''
118118

119119

120-
def get_version():
121-
version_file = read('pytest_flask', '__init__.py')
122-
version_match = re.search(r'^__version__ = [\'"]([^\'"]*)[\'"]',
123-
version_file, re.MULTILINE)
124-
if version_match:
125-
return version_match.group(1)
126-
raise RuntimeError('Unable to find version string.')
127-
128-
129-
version = get_version()
130120
requirements = read('requirements', 'main.txt').splitlines() + ['pytest']
131121
tests_require = []
132122

@@ -139,16 +129,19 @@ def get_version():
139129
setup(
140130
name='pytest-flask',
141131

142-
# Versions should comply with PEP440. For a discussion on single-sourcing
143-
# the version across setup.py and the project code, see
144-
# http://packaging.python.org/en/latest/tutorial.html#version
145-
version=version,
132+
# Versions should comply with PEP440, and automatically obtained from tags
133+
# thanks to setuptools_scm
134+
use_scm_version={"write_to": "pytest_flask/_version.py"},
135+
setup_requires=["setuptools-scm"],
146136

147137
author='Vital Kudzelka',
148138
author_email='[email protected]',
149139

150140
url='https://github.com/vitalk/pytest-flask',
151-
download_url='https://github.com/vitalk/pytest-flask/tarball/%s' % version,
141+
project_urls={
142+
"Source": "https://github.com/pytest-dev/pytest-flask",
143+
"Tracker": "https://github.com/pytest-dev/pytest-flask/issues",
144+
},
152145
description='A set of py.test fixtures to test Flask applications.',
153146
long_description=__doc__,
154147
license='MIT',
@@ -173,7 +166,10 @@ def get_version():
173166
'Programming Language :: Python :: 2',
174167
'Programming Language :: Python :: 2.7',
175168
'Programming Language :: Python :: 3',
176-
'Programming Language :: Python :: 3.3',
169+
'Programming Language :: Python :: 3.4',
170+
'Programming Language :: Python :: 3.5',
171+
'Programming Language :: Python :: 3.6',
172+
'Programming Language :: Python :: 3.7',
177173
'Topic :: Software Development :: Testing',
178174
'Topic :: Software Development :: Libraries :: Python Modules',
179175
],

tests/test_live_server.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/usr/bin/env python
22
# -*- coding: utf-8 -*-
3+
import os
4+
35
import pytest
46
try:
57
from urllib2 import urlopen
@@ -9,6 +11,9 @@
911
from flask import url_for
1012

1113

14+
pytestmark = pytest.mark.skipif(not hasattr(os, 'fork'), reason='needs fork')
15+
16+
1217
class TestLiveServer:
1318

1419
def test_server_is_alive(self, live_server):

tox.ini

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
[tox]
22
envlist =
3-
py{36,35}-pytest{31,30,29,28,27}
4-
py{34,33,27,26}-pytest{31,30,29,28,27,26}
5-
pypy-pytest{31,30,29,28,27,26}
3+
py{27,34,35,36,37}
64

75

86
[pytest]
@@ -16,27 +14,19 @@ pep8maxlinelength = 119
1614
usedevelop = True
1715
deps =
1816
-rrequirements/main.txt
19-
-rrequirements/test.txt
20-
pytest26: pytest>=2.6,<2.7
21-
pytest27: pytest>=2.7,<2.8
22-
pytest28: pytest>=2.8,<2.9
23-
pytest29: pytest>=2.9,<3.0
24-
pytest30: pytest>=3.0,<3.1
25-
pytest31: pytest>=3.1,<3.2
26-
pytest26: pytest-xdist<1.16.0
27-
pytest{31,30,29,28,27}: pytest-xdist
17+
-rrequirements/test.txt
2818

2919
passenv = HOME LANG LC_ALL
3020

3121
commands =
32-
py.test -q --basetemp={envtmpdir} --confcutdir=.. -n 1 \
22+
pytest --basetemp={envtmpdir} --confcutdir=tests \
3323
--junitxml=tests/junit.xml \
3424
--cov-report xml --cov pytest_flask \
3525
--cov-report=html \
3626
--cov-report term-missing \
3727
--pep8 \
38-
-n 2 \
39-
{posargs}
28+
-ra \
29+
{posargs:tests}
4030

4131

4232
[testenv:docs]
@@ -48,12 +38,3 @@ commands =
4838

4939
whitelist_externals =
5040
/usr/bin/make
51-
52-
53-
[tox:travis]
54-
2.6 = py26-pytest{31,30,29,28,27,26}
55-
2.7 = py27-pytest{31,30,29,28,27,26}
56-
3.3 = py33-pytest{31,30,29,28,27,26}
57-
3.4 = py34-pytest{31,30,29,28,27,26}
58-
3.5 = py35-pytest{31,30,29,28,27}
59-
3.6 = py36-pytest{31,30,29,28,27}

0 commit comments

Comments
 (0)