Skip to content

Commit 21aa8c5

Browse files
authored
Add builds for new py versions and Windows to CircleCI (#245)
* All: Add a CircleCI Windows build with py3.6-py3.12 and remove references to TravisCI. (#246) * All: Add Ubuntu builds for py3.6-3.13 * All: CircleCI release jobs now depend on both Ubuntu and Windows success. * pytest-profiling: Small refactor to make error messages a bit clearer * pytest-profiling: Fixed tests which were installing from PyPI rather than local * pytest-profiling: Removed usage of deprecated `pytest.yield_fixture`. * pytest-profiling: Removed usage of `distutils`, where possible. * pytest-server-fixtures: Minor bugfix now that workspace.workspace is a Path object. * pytest-virtualenv: Added default to install editable packages by using direct_url.json, if it exists * pytest-virtualenv: Fixed Windows compatibility issues * ci: Remove custom hooks from `python setup.py test` since this is no longer supported. * ci: Fix build-related buttons in README.md.
1 parent 286e040 commit 21aa8c5

File tree

16 files changed

+285
-278
lines changed

16 files changed

+285
-278
lines changed

.circleci/config.yml

Lines changed: 82 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,40 @@
1+
orbs:
2+
win: circleci/[email protected]
3+
4+
windows-tmpl: &windows-tmpl
5+
parameters:
6+
python-version:
7+
type: string
8+
executor:
9+
name: win/default
10+
shell: bash.exe
11+
steps:
12+
- checkout
13+
- run:
14+
name: Set up Python
15+
command: |
16+
set -e
17+
. install.sh
18+
install_windows_make
19+
install_windows_python << parameters.python_version >>
20+
init_venv python
21+
- run:
22+
name: Install dependencies
23+
command: |
24+
python --version
25+
make develop
26+
- run:
27+
name: Run tests
28+
command: |
29+
export DEBUG=1
30+
export SERVER_FIXTURES_JENKINS_WAR=
31+
export PACKAGES=$(./foreach.sh --quiet 'grep -q Windows setup.py && echo $PKG || true')
32+
make test-ci
33+
- store_test_results:
34+
path: junit
35+
- run:
36+
name: Check for failures
37+
command: make list-test-failures
138

239
test-tmpl: &test-tmpl
340
command: |
@@ -6,7 +43,8 @@ test-tmpl: &test-tmpl
643
export DEBUG=1
744
export SERVER_FIXTURES_HOSTNAME=127.0.0.1
845
export SERVER_FIXTURES_JENKINS_WAR=
9-
cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc setup.py test -sv -ra || touch ../FAILED-$(basename $PWD)
46+
set -x
47+
cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc -m pytest --junitxml junit.xml -svvvv -ra || touch ../FAILED-$(basename $PWD)
1048
1149
job-tmpl: &job-tmpl
1250
machine:
@@ -43,6 +81,9 @@ job-tmpl: &job-tmpl
4381
- run:
4482
name: Install Mongodb
4583
command: sudo bash -c "source ./install.sh && install_mongodb"
84+
- run:
85+
name: Install Graphviz
86+
command: sudo bash -c "source ./install.sh && install_graphviz"
4687
- run:
4788
name: Install Apache
4889
command: sudo bash -c "source ./install.sh && install_apache"
@@ -148,17 +189,22 @@ job-tmpl: &job-tmpl
148189
- ./*
149190
- ./dist/*
150191

151-
version: 2
192+
version: 2.1
152193
jobs:
153-
py36:
194+
python-ubuntu:
154195
<<: *job-tmpl
196+
parameters:
197+
python_version:
198+
type: string
155199
environment:
156-
PYTHON: "python3.6"
157-
158-
py37:
159-
<<: *job-tmpl
200+
PYTHON: << parameters.python_version >>
201+
python-windows:
202+
<<: *windows-tmpl
203+
parameters:
204+
python_version:
205+
type: string
160206
environment:
161-
PYTHON: "python3.7"
207+
PYTHON: << parameters.python_version >>
162208

163209
pypi-release:
164210
docker:
@@ -212,27 +258,48 @@ jobs:
212258
-n ${VERSION} \
213259
-b "${CHANGES}" \
214260
-soft \
215-
${VERSION} /tmp/to-release/dist
261+
"v${VERSION}" /tmp/to-release/dist
216262
217263
218264
workflows:
219265
version: 2
220266
pytest-plugins:
221267
jobs:
222-
- py36
223-
- py37
268+
- python-windows:
269+
matrix:
270+
parameters:
271+
python_version:
272+
- "python3.6"
273+
- "python3.7"
274+
- "python3.8"
275+
- "python3.9"
276+
- "python3.10"
277+
- "python3.11"
278+
- "python3.12"
279+
- python-ubuntu:
280+
matrix:
281+
parameters:
282+
python_version:
283+
- "python3.6"
284+
- "python3.7"
285+
- "python3.8"
286+
- "python3.9"
287+
- "python3.10"
288+
- "python3.11"
289+
- "python3.12"
290+
- "python3.13"
224291
- pypi-release:
225292
requires:
226-
- py36
227-
- py37
293+
- python-ubuntu
294+
- python-windows
228295
filters:
229296
branches:
230297
only:
231298
- master
232299
- publish-github-release:
233300
requires:
234-
- py36
235-
- py37
301+
- python-ubuntu
302+
- python-windows
236303
filters:
237304
branches:
238305
only:

.travis.yml

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

CHANGES.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Changelog
2-
### 1.8.0 (2024-10-??)
2+
### 1.8.1 (2024-10-??)
3+
* All: Windows builds added to CircleCI
4+
* All: Started building py3.6-py3.13 in CircleCI
5+
6+
### 1.8.0 (2024-10-17)
37
* All: Drop support for Python 2 and <3.6, removing compatibility code.
48
* All: Use stdlib unittest.mock instead of mock package.
59
* All: Removed usage of path.py and path in favour of pathlib. #174 #224

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,18 @@ test:
5454

5555
test-ci:
5656
rm -f FAILED-*
57-
./foreach.sh 'cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc setup.py test -sv -ra --timeout 120 || touch ../FAILED-$$PKG'
57+
mkdir junit
58+
./foreach.sh 'cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc -m pytest --junitxml junit.xml -svvvv -ra || touch ../FAILED-$$PKG'
59+
./foreach.sh 'cp junit.xml ../junit/junit-$PKG.xml || true'
60+
61+
list-test-failures:
62+
@if compgen -G 'FAILED-*' > /dev/null; then \
63+
echo "Error: Found failure artifacts:"; \
64+
compgen -G 'FAILED-*'; \
65+
exit 1; \
66+
else \
67+
echo "No failure artifacts found."; \
68+
fi
5869

5970
upload:
6071
pip install twine

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# A goody-bag of nifty plugins for [pytest](https://pytest.org)
22

3-
OS | Build | Coverage |
4-
------ | ----- | -------- |
5-
![Linux](img/linux.png) | [![CircleCI (Linux)](https://circleci.com/gh/man-group/pytest-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/man-group/pytest-plugins/tree/master) | [![Coverage Status](https://coveralls.io/repos/github/manahl/pytest-plugins/badge.svg?branch=master)](https://coveralls.io/github/manahl/pytest-plugins?branch=master)
6-
![Windows](img/windows.png) | [![Travic CI (Windows)](https://travis-ci.org/man-group/pytest-plugins.svg?branch=master)](https://travis-ci.org/man-group/pytest-plugins) |
3+
OS | Build | Coverage |
4+
------ |------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
5+
![Linux](img/linux.png) | [![CircleCI (Linux)](https://circleci.com/gh/man-group/pytest-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/man-group/pytest-plugins/tree/master) | [![Coverage Status](https://coveralls.io/repos/github/manahl/pytest-plugins/badge.svg?branch=master)](https://coveralls.io/github/manahl/pytest-plugins?branch=master)
6+
![Windows](img/windows.png) | [![CircleCI (Linux)](https://circleci.com/gh/man-group/pytest-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/man-group/pytest-plugins/tree/master) |
77

88
Plugin | Description | Supported OS |
99
------ | ----------- | ------------ |

common_setup.py

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,16 @@
11
# Common setup.py code shared between all the projects in this repository
2-
import sys
32
import os
4-
import logging
5-
6-
from setuptools.command.test import test as TestCommand
7-
from setuptools.command.egg_info import egg_info as EggInfoCommand
8-
9-
10-
class PyTest(TestCommand):
11-
pytest_args = []
12-
src_dir = None
13-
14-
def initialize_options(self):
15-
TestCommand.initialize_options(self)
16-
17-
def finalize_options(self):
18-
TestCommand.finalize_options(self)
19-
self.test_args = []
20-
self.test_suite = True
21-
22-
def run_tests(self):
23-
global pytest_args
24-
logging.basicConfig(format='%(asctime)s %(levelname)s %(name)s %(message)s', level='DEBUG')
25-
26-
# import here, cause outside the eggs aren't loaded
27-
import pytest
28-
29-
self.pytest_args.extend(['--junitxml', 'junit.xml'])
30-
errno = pytest.main(self.pytest_args)
31-
sys.exit(errno)
32-
33-
34-
class EggInfo(EggInfoCommand):
35-
""" Customisation of the package metadata creation. Changes are:
36-
- Save the test requirements into an extra called 'tests'
37-
"""
38-
def run(self):
39-
if self.distribution.extras_require is None:
40-
self.distribution.extras_require = {}
41-
if 'tests' not in self.distribution.extras_require and hasattr(self.distribution, 'tests_require'):
42-
self.distribution.extras_require['tests'] = self.distribution.tests_require
43-
EggInfoCommand.run(self)
443

454

465
def common_setup(src_dir):
476
this_dir = os.path.dirname(__file__)
487
readme_file = os.path.join(this_dir, 'README.md')
498
changelog_file = os.path.join(this_dir, 'CHANGES.md')
509
version_file = os.path.join(this_dir, 'VERSION')
10+
5111
long_description = open(readme_file).read()
5212
changelog = open(changelog_file).read()
5313

54-
# Gather trailing arguments for pytest, this can't be done using setuptools' api
55-
if 'test' in sys.argv:
56-
PyTest.pytest_args = sys.argv[sys.argv.index('test') + 1:]
57-
if PyTest.pytest_args:
58-
sys.argv = sys.argv[:-len(PyTest.pytest_args)]
59-
PyTest.src_dir = src_dir
60-
6114
return dict(
6215
# Version is shared between all the projects in this repo
6316
version=open(version_file).read().strip(),
@@ -66,7 +19,6 @@ def common_setup(src_dir):
6619
url='https://github.com/man-group/pytest-plugins',
6720
license='MIT license',
6821
platforms=['unix', 'linux'],
69-
cmdclass={'test': PyTest, 'egg_info': EggInfo},
7022
include_package_data=True,
7123
python_requires='>=3.6',
7224
)

0 commit comments

Comments
 (0)