Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add builds for new py versions and Windows to CircleCI #245

Merged
merged 20 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
86e999f
Experiment with new versions of python
jonbannister Aug 30, 2024
388b185
Try using pypa
jonbannister Aug 30, 2024
38abe56
Add some debugging to common_setup.py
jonbannister Sep 2, 2024
6dba02c
Try something a little different
jonbannister Sep 2, 2024
bea1bb9
Attempt to fix "int" issue with pytest-profiling
jonbannister Oct 17, 2024
ca78856
Replace debugging in test-tmpl
jonbannister Oct 18, 2024
4e2bdd0
Remove usage of deprecated PyTest test command & add junit.xml to tes…
jonbannister Oct 18, 2024
df11846
Increase logging level, ensure that pytest-profiling actually tests t…
jonbannister Oct 19, 2024
c230d7f
Install graphviz as part of build
jonbannister Oct 19, 2024
83cc900
Remove usage of distutils and fix pytest-profiling's piping between g…
jonbannister Oct 19, 2024
2552d26
Fix pytest-profiling unit tests, and silently-failing log message in …
jonbannister Oct 19, 2024
f9c698a
Remove f-string = specifiers since we still support python3.6
jonbannister Oct 19, 2024
0977b51
Re-introduce distutils for python <3.8 compat. Fix verbose-parametriz…
jonbannister Oct 19, 2024
6c6736e
Pytest<8 has the fully qualified name in the output of --collectonly
jonbannister Oct 19, 2024
b9fe0b3
Use direct_url.json instead of egg-link in pip>=19.3
jonbannister Oct 19, 2024
6c84761
Do not attempt to import pkg_resources unless trying to install from egg
jonbannister Oct 19, 2024
327987a
importlib_metadata for py<3.8, enabling py3.13.
jonbannister Oct 19, 2024
3b41dc2
Add a CircleCI Windows build (#246)
jonbannister Oct 20, 2024
205a4e0
Re-add some logic to allow common_setup.py to be imported by pytest-p…
jonbannister Oct 21, 2024
4c82015
Re-add testing line which was failing locally for unrelated reasons.
jonbannister Oct 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 82 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
orbs:
win: circleci/[email protected]

windows-tmpl: &windows-tmpl
parameters:
python-version:
type: string
executor:
name: win/default
shell: bash.exe
steps:
- checkout
- run:
name: Set up Python
command: |
set -e
. install.sh
install_windows_make
install_windows_python << parameters.python_version >>
init_venv python
- run:
name: Install dependencies
command: |
python --version
make develop
- run:
name: Run tests
command: |
export DEBUG=1
export SERVER_FIXTURES_JENKINS_WAR=
export PACKAGES=$(./foreach.sh --quiet 'grep -q Windows setup.py && echo $PKG || true')
make test-ci
- store_test_results:
path: junit
- run:
name: Check for failures
command: make list-test-failures

test-tmpl: &test-tmpl
command: |
Expand All @@ -6,7 +43,8 @@ test-tmpl: &test-tmpl
export DEBUG=1
export SERVER_FIXTURES_HOSTNAME=127.0.0.1
export SERVER_FIXTURES_JENKINS_WAR=
cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc setup.py test -sv -ra || touch ../FAILED-$(basename $PWD)
set -x
cat *.egg-info/top_level.txt | xargs -Ipysrc coverage run -p --source=pysrc -m pytest --junitxml junit.xml -svvvv -ra || touch ../FAILED-$(basename $PWD)

job-tmpl: &job-tmpl
machine:
Expand Down Expand Up @@ -43,6 +81,9 @@ job-tmpl: &job-tmpl
- run:
name: Install Mongodb
command: sudo bash -c "source ./install.sh && install_mongodb"
- run:
name: Install Graphviz
command: sudo bash -c "source ./install.sh && install_graphviz"
- run:
name: Install Apache
command: sudo bash -c "source ./install.sh && install_apache"
Expand Down Expand Up @@ -148,17 +189,22 @@ job-tmpl: &job-tmpl
- ./*
- ./dist/*

version: 2
version: 2.1
jobs:
py36:
python-ubuntu:
<<: *job-tmpl
parameters:
python_version:
type: string
environment:
PYTHON: "python3.6"

py37:
<<: *job-tmpl
PYTHON: << parameters.python_version >>
python-windows:
<<: *windows-tmpl
parameters:
python_version:
type: string
environment:
PYTHON: "python3.7"
PYTHON: << parameters.python_version >>

pypi-release:
docker:
Expand Down Expand Up @@ -212,27 +258,48 @@ jobs:
-n ${VERSION} \
-b "${CHANGES}" \
-soft \
${VERSION} /tmp/to-release/dist
"v${VERSION}" /tmp/to-release/dist


workflows:
version: 2
pytest-plugins:
jobs:
- py36
- py37
- python-windows:
matrix:
parameters:
python_version:
- "python3.6"
- "python3.7"
- "python3.8"
- "python3.9"
- "python3.10"
- "python3.11"
- "python3.12"
- python-ubuntu:
matrix:
parameters:
python_version:
- "python3.6"
- "python3.7"
- "python3.8"
- "python3.9"
- "python3.10"
- "python3.11"
- "python3.12"
- "python3.13"
- pypi-release:
requires:
- py36
- py37
- python-ubuntu
- python-windows
filters:
branches:
only:
- master
- publish-github-release:
requires:
- py36
- py37
- python-ubuntu
- python-windows
filters:
branches:
only:
Expand Down
66 changes: 0 additions & 66 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Changelog
### 1.8.0 (2024-10-??)
### 1.8.1 (2024-10-??)
* All: Windows builds added to CircleCI
* All: Started building py3.6-py3.13 in CircleCI

### 1.8.0 (2024-10-17)
* All: Drop support for Python 2 and <3.6, removing compatibility code.
* All: Use stdlib unittest.mock instead of mock package.
* All: Removed usage of path.py and path in favour of pathlib. #174 #224
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,18 @@ test:

test-ci:
rm -f FAILED-*
./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'
mkdir junit
./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'
./foreach.sh 'cp junit.xml ../junit/junit-$PKG.xml || true'

list-test-failures:
@if compgen -G 'FAILED-*' > /dev/null; then \
echo "Error: Found failure artifacts:"; \
compgen -G 'FAILED-*'; \
exit 1; \
else \
echo "No failure artifacts found."; \
fi

upload:
pip install twine
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# A goody-bag of nifty plugins for [pytest](https://pytest.org)

OS | Build | Coverage |
------ | ----- | -------- |
![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)
![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) |
OS | Build | Coverage |
------ |------------------------------------------------------------------------------------------------------------------------------------------------------------------| -------- |
![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)
![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) |

Plugin | Description | Supported OS |
------ | ----------- | ------------ |
Expand Down
50 changes: 1 addition & 49 deletions common_setup.py
Original file line number Diff line number Diff line change
@@ -1,63 +1,16 @@
# Common setup.py code shared between all the projects in this repository
import sys
import os
import logging

from setuptools.command.test import test as TestCommand
from setuptools.command.egg_info import egg_info as EggInfoCommand


class PyTest(TestCommand):
pytest_args = []
src_dir = None

def initialize_options(self):
TestCommand.initialize_options(self)

def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True

def run_tests(self):
global pytest_args
logging.basicConfig(format='%(asctime)s %(levelname)s %(name)s %(message)s', level='DEBUG')

# import here, cause outside the eggs aren't loaded
import pytest

self.pytest_args.extend(['--junitxml', 'junit.xml'])
errno = pytest.main(self.pytest_args)
sys.exit(errno)


class EggInfo(EggInfoCommand):
""" Customisation of the package metadata creation. Changes are:
- Save the test requirements into an extra called 'tests'
"""
def run(self):
if self.distribution.extras_require is None:
self.distribution.extras_require = {}
if 'tests' not in self.distribution.extras_require and hasattr(self.distribution, 'tests_require'):
self.distribution.extras_require['tests'] = self.distribution.tests_require
EggInfoCommand.run(self)


def common_setup(src_dir):
this_dir = os.path.dirname(__file__)
readme_file = os.path.join(this_dir, 'README.md')
changelog_file = os.path.join(this_dir, 'CHANGES.md')
version_file = os.path.join(this_dir, 'VERSION')

long_description = open(readme_file).read()
changelog = open(changelog_file).read()

# Gather trailing arguments for pytest, this can't be done using setuptools' api
if 'test' in sys.argv:
PyTest.pytest_args = sys.argv[sys.argv.index('test') + 1:]
if PyTest.pytest_args:
sys.argv = sys.argv[:-len(PyTest.pytest_args)]
PyTest.src_dir = src_dir

return dict(
# Version is shared between all the projects in this repo
version=open(version_file).read().strip(),
Expand All @@ -66,7 +19,6 @@ def common_setup(src_dir):
url='https://github.com/man-group/pytest-plugins',
license='MIT license',
platforms=['unix', 'linux'],
cmdclass={'test': PyTest, 'egg_info': EggInfo},
include_package_data=True,
python_requires='>=3.6',
)
Loading