Skip to content

Commit 8da14ac

Browse files
Merge pull request #18 from pytest-dev/modernize
update to new tools
2 parents cd65de2 + 1bfcbb2 commit 8da14ac

20 files changed

+538
-287
lines changed

.github/workflows/deploy.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types:
9+
- published
10+
11+
jobs:
12+
build:
13+
if: github.repository == 'pytest-dev/apipkg'
14+
runs-on: ubuntu-20.04
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- run: |
19+
git fetch --prune --unshallow
20+
21+
- name: Cache
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.cache/pip
25+
key: deploy-${{ hashFiles('**/setup.cfg') }}
26+
restore-keys: |
27+
deploy-
28+
29+
- name: Set up Python
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: 3.9
33+
34+
- name: Install dependencies
35+
run: |
36+
python -m pip install -U pip
37+
python -m pip install -U setuptools setuptools_scm twine wheel
38+
39+
- name: Build package
40+
run: |
41+
git tag
42+
python setup.py --version
43+
python setup.py sdist --format=gztar bdist_wheel
44+
twine check dist/*
45+
46+
- name: Publish package to PyPI
47+
if: github.event.action == 'published'
48+
uses: pypa/gh-action-pypi-publish@master
49+
with:
50+
user: __token__
51+
password: ${{ secrets.pypi_token }}
52+
53+
- name: Publish package to TestPyPI
54+
uses: pypa/gh-action-pypi-publish@master
55+
with:
56+
user: __token__
57+
password: ${{ secrets.test_pypi_token }}
58+
repository_url: https://test.pypi.org/legacy/

.github/workflows/pre-commit.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: pre-commit/[email protected]

.github/workflows/pythonapp.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Python application
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
# todo: extract from source
14+
python-version: [2.7, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9]
15+
install-style: [full, editable]
16+
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install -U setuptools setuptools_scm
27+
pip install pytest
28+
29+
- name: install editable
30+
run: pip install -e .
31+
if: matrix.install-style=='editable'
32+
- name: install full
33+
run: pip install .
34+
35+
if: matrix.install-style=='full'
36+
37+
- name: pytest
38+
run: pytest

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ __pycache__
33
*.egg-info
44
.pytest_cache/
55
.eggs/
6+
.tox/

.pre-commit-config.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
repos:
2+
- repo: https://github.com/psf/black
3+
rev: 20.8b1
4+
hooks:
5+
- id: black
6+
args: [--safe, --quiet]
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v3.4.0
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: end-of-file-fixer
12+
- id: fix-encoding-pragma
13+
args: [--remove]
14+
- id: check-yaml
15+
- id: debug-statements
16+
language_version: python3
17+
- repo: https://gitlab.com/pycqa/flake8
18+
rev: 3.8.4
19+
hooks:
20+
- id: flake8
21+
language_version: python3
22+
additional_dependencies:
23+
- flake8-typing-imports==1.9.0
24+
- repo: https://github.com/asottile/reorder_python_imports
25+
rev: v2.3.6
26+
hooks:
27+
- id: reorder-python-imports
28+
args: ['--application-directories=.:src']
29+
- repo: https://github.com/asottile/pyupgrade
30+
rev: v2.8.0
31+
hooks:
32+
- id: pyupgrade
33+
- repo: https://github.com/asottile/setup-cfg-fmt
34+
rev: v1.16.0
35+
hooks:
36+
- id: setup-cfg-fmt
37+
args: [--min-py3-version=3.4]

.travis.yml

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

CHANGELOG

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,3 @@
7373

7474
- added special __onfirstaccess__ attribute whose value will
7575
be called on the first attribute access of an apimodule.
76-

LICENSE

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@
55
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
66
copies of the Software, and to permit persons to whom the Software is
77
furnished to do so, subject to the following conditions:
8-
8+
99
The above copyright notice and this permission notice shall be included in all
1010
copies or substantial portions of the Software.
11-
11+
1212
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1313
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1414
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1515
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1616
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1717
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1818
SOFTWARE.
19-

conftest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import py
2+
23
import apipkg
3-
LOCAL_APIPKG = py.path.local(__file__).dirpath().join('src/apipkg/__init__.py')
4-
INSTALL_TYPE = 'editable' if apipkg.__file__ == LOCAL_APIPKG else 'full'
4+
5+
LOCAL_APIPKG = py.path.local(__file__).dirpath().join("src/apipkg/__init__.py")
6+
INSTALL_TYPE = "editable" if apipkg.__file__ == LOCAL_APIPKG else "full"
57

68

79
def pytest_report_header(startdir):
810
return "apipkg {install_type} install version={version}".format(
9-
install_type=INSTALL_TYPE, version=apipkg.__version__)
11+
install_type=INSTALL_TYPE, version=apipkg.__version__
12+
)

example/_mypkg/othermodule.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
21
class OtherClass:
32
pass

0 commit comments

Comments
 (0)