Skip to content

Commit 9f267e0

Browse files
authored
Merge pull request pytest-dev#153 from man-group/feature/windows-build
Created Windows build on Travis
2 parents b16b119 + 6f77f02 commit 9f267e0

File tree

13 files changed

+190
-69
lines changed

13 files changed

+190
-69
lines changed

.circleci/circle_artifact.py

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

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
test-tmpl: &test-tmpl
23
command: |
34
. ../venv/bin/activate

.travis.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
language: sh
2+
3+
os:
4+
- windows
5+
6+
python:
7+
- "2.7"
8+
- "3.5"
9+
- "3.6"
10+
- "3.7"
11+
12+
jobs:
13+
include:
14+
- name: "Python 2.7 on Windows"
15+
python: "2.7"
16+
before_install:
17+
- set -e
18+
- . install.sh
19+
- install_windows_make
20+
- install_windows_py27
21+
- init_venv python
22+
- name: "Python 3.5 on Windows"
23+
python: "3.5"
24+
before_install:
25+
- set -e
26+
- . install.sh
27+
- install_windows_make
28+
- install_windows_py35
29+
- init_venv python
30+
- name: "Python 3.6 on Windows"
31+
python: "3.6"
32+
before_install:
33+
- set -e
34+
- . install.sh
35+
- install_windows_make
36+
- install_windows_py36
37+
- init_venv python
38+
- name: "Python 3.7 on Windows"
39+
python: "3.7"
40+
before_install:
41+
- set -e
42+
- . install.sh
43+
- install_windows_make
44+
- install_windows_py37
45+
- init_venv python
46+
47+
install:
48+
- python --version
49+
- make develop
50+
before_script:
51+
- export DEBUG=1
52+
- export SERVER_FIXTURES_JENKINS_WAR=
53+
# Select all packages with the Windows classifier
54+
- export PACKAGES=$(./foreach.sh --quiet 'grep -q Windows setup.py && echo $PKG || true')
55+
script:
56+
- make test-ci
57+
after_script:
58+
- bash -c "! compgen -G 'FAILED-*'"
59+
60+
cache:
61+
directories:
62+
- ~/AppData/Local/pip/Cache
63+
64+
git:
65+
depth: false
66+
submodules: false

Makefile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Package list, in order of ancestry
22
# removed pytest-qt-app
33
EXTRA_DEPS = setuptools-git \
4+
pytest-timeout \
45
pypandoc \
56
wheel \
67
coverage \
@@ -46,9 +47,13 @@ develop: copyfiles extras
4647

4748
test:
4849
rm -f FAILED-*
49-
./foreach.sh 'DEBUG=1 python setup.py test || touch ../FAILED-$$PKG'
50+
./foreach.sh 'DEBUG=1 python setup.py test -sv -ra || touch ../FAILED-$$PKG'
5051
bash -c "! compgen -G 'FAILED-*'"
5152

53+
test-ci:
54+
rm -f FAILED-*
55+
./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'
56+
5257
upload:
5358
pip install twine
5459
./foreach.sh --changed '[ -f common_setup.py ] && twine upload $(UPLOAD_OPTS) dist/*'

README.md

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

3-
[![CircleCI](https://circleci.com/gh/man-group/pytest-plugins/tree/master.svg?style=svg)](https://circleci.com/gh/man-group/pytest-plugins/tree/master)
4-
[![Coverage Status](https://coveralls.io/repos/github/manahl/pytest-plugins/badge.svg?branch=master)](https://coveralls.io/github/manahl/pytest-plugins?branch=master)
5-
6-
Plugin | Description |
7-
------ | ----------- |
8-
| [pytest-server-fixtures](pytest-server-fixtures) | Extensible server-running framework with a suite of well-known databases and webservices included |
9-
| [pytest-shutil](pytest-shutil) | Unix shell and environment management tools |
10-
| [pytest-profiling](pytest-profiling) | Profiling plugin with tabular heat graph output and gprof support for C-Extensions |
11-
| [pytest-devpi-server](pytest-devpi-server) | DevPI server fixture |
12-
| [pytest-pyramid-server](pytest-pyramid-server) | Pyramid server fixture |
13-
| [pytest-webdriver](pytest-webdriver) | Selenium webdriver fixture |
14-
| [pytest-virtualenv](pytest-virtualenv) | Virtualenv fixture |
15-
| [pytest-qt-app](pytest-qt-app) | PyQT application fixture |
16-
| [pytest-listener](pytest-listener) | TCP Listener/Reciever for testing remote systems |
17-
| [pytest-git](pytest-git) | Git repository fixture |
18-
| [pytest-svn](pytest-svn) | SVN repository fixture |
19-
| [pytest-fixture-config](pytest-fixture-config) | Configuration tools for Py.test fixtures |
20-
| [pytest-verbose-parametrize](pytest-verbose-parametrize) | Makes py.test's parametrize output a little more verbose |
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) |
7+
8+
Plugin | Description | Supported OS |
9+
------ | ----------- | ------------ |
10+
| [pytest-server-fixtures](pytest-server-fixtures) | Extensible server-running framework with a suite of well-known databases and webservices included | ![Linux](img/linux.png)
11+
| [pytest-shutil](pytest-shutil) | Unix shell and environment management tools |![Linux](img/linux.png)
12+
| [pytest-profiling](pytest-profiling) | Profiling plugin with tabular heat graph output and gprof support for C-Extensions |![Linux](img/linux.png)
13+
| [pytest-devpi-server](pytest-devpi-server) | DevPI server fixture |![Linux](img/linux.png)
14+
| [pytest-pyramid-server](pytest-pyramid-server) | Pyramid server fixture |![Linux](img/linux.png)
15+
| [pytest-webdriver](pytest-webdriver) | Selenium webdriver fixture |![Linux](img/linux.png)
16+
| [pytest-virtualenv](pytest-virtualenv) | Virtualenv fixture |![Linux](img/linux.png) ![Windows](img/windows.png)
17+
| [pytest-qt-app](pytest-qt-app) | PyQT application fixture |![Linux](img/linux.png)
18+
| [pytest-listener](pytest-listener) | TCP Listener/Reciever for testing remote systems |![Linux](img/linux.png) ![Windows](img/windows.png)
19+
| [pytest-git](pytest-git) | Git repository fixture |![Linux](img/linux.png) ![Windows](img/windows.png)
20+
| [pytest-svn](pytest-svn) | SVN repository fixture |![Linux](img/linux.png)
21+
| [pytest-fixture-config](pytest-fixture-config) | Configuration tools for Py.test fixtures |![Linux](img/linux.png) ![Windows](img/windows.png)
22+
| [pytest-verbose-parametrize](pytest-verbose-parametrize) | Makes py.test's parametrize output a little more verbose |![Linux](img/linux.png)
2123

2224

2325
## Developing these plugins
@@ -61,7 +63,7 @@ To setup test environment in Vagrant (requires virtualbox):
6163
make test
6264
```
6365

64-
## `foreach.sh`
66+
## `foreach.sh`
6567

6668
To run a command in each of the package directories, use the `foreach.sh` script.
6769
This example will build all the wheel distributions:

foreach.sh

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
# Run a command for each of our packages
33
set -ef
44

5+
QUIET=0
6+
if [ "$1" = '--quiet' ]; then
7+
QUIET=1
8+
shift
9+
fi
10+
511
if [ "$1" = '--changed' ]; then
612
shift
713
# Package list, filtered to ones changed since last tag
@@ -10,28 +16,33 @@ if [ "$1" = '--changed' ]; then
1016
else
1117
# Package list, in order of ancestry
1218
# removed pytest-qt-app
13-
PACKAGES="pytest-fixture-config \
14-
pytest-shutil \
15-
pytest-server-fixtures \
16-
pytest-pyramid-server \
17-
pytest-devpi-server \
18-
pytest-listener \
19-
pytest-svn \
20-
pytest-git \
21-
pytest-virtualenv \
22-
pytest-webdriver \
23-
pytest-profiling \
19+
DEFAULT_PACKAGES="pytest-fixture-config \
20+
pytest-shutil \
21+
pytest-server-fixtures \
22+
pytest-pyramid-server \
23+
pytest-devpi-server \
24+
pytest-listener \
25+
pytest-svn \
26+
pytest-git \
27+
pytest-virtualenv \
28+
pytest-webdriver \
29+
pytest-profiling \
2430
pytest-verbose-parametrize"
31+
PACKAGES="${PACKAGES:-$DEFAULT_PACKAGES}"
2532
fi
2633

2734
for pkg in $PACKAGES; do
2835
export PKG=$pkg
2936
(cd $pkg
30-
echo "-----------------------------------------------------"
31-
echo " $pkg"
32-
echo "-----------------------------------------------------"
33-
echo
34-
bash -x -c "$*"
35-
echo
37+
if [ $QUIET -eq 1 ]; then
38+
bash -c "$*"
39+
else
40+
echo "-----------------------------------------------------"
41+
echo " $pkg"
42+
echo "-----------------------------------------------------"
43+
echo
44+
bash -x -c "$*"
45+
echo
46+
fi
3647
)
3748
done

img/linux.png

1.45 KB
Loading

img/windows.png

646 Bytes
Loading

install.sh

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,80 @@ function install_python_ppa {
2121
apt-get update
2222
}
2323

24+
function install_python_packaging {
25+
local py=$1
26+
$py -m pip install --upgrade pip
27+
$py -m pip install --upgrade setuptools
28+
$py -m pip install --upgrade virtualenv
29+
}
30+
31+
2432
function install_python {
2533
local py=$1
2634
apt-get install -y $py $py-dev
2735
curl --silent --show-error --retry 5 https://bootstrap.pypa.io/get-pip.py | $py
28-
$py -m pip install --upgrade pip
29-
$py -m pip install --upgrade virtualenv
36+
install_python_packaging $py
3037
}
3138

39+
40+
function choco_install {
41+
local args=$*
42+
# choco fails randomly with network errors on travis, have a few goes
43+
for i in {1..5}; do
44+
choco install $args && return 0
45+
echo 'choco install failed, log tail follows:'
46+
tail -500 C:/ProgramData/chocolatey/logs/chocolatey.log
47+
echo 'sleeping for a bit and retrying'.
48+
sleep 5
49+
done
50+
return 1
51+
}
52+
53+
54+
function install_windows_make {
55+
choco_install make --params "/InstallDir:C:\\tools\\make"
56+
}
57+
58+
59+
function install_windows_py27 {
60+
choco_install python2 --params "/InstallDir:C:\\Python"
61+
export PATH="/c/Python:/c/Python/Scripts:$PATH"
62+
install_python_packaging python
63+
}
64+
65+
66+
function install_windows_py35 {
67+
choco_install python --version 3.5.4 --params "/InstallDir:C:\\Python"
68+
export PATH="/c/Python35:/c/Python35/Scripts:$PATH"
69+
install_python_packaging python
70+
}
71+
72+
73+
function install_windows_py36 {
74+
choco_install python --version 3.6.8 --params "/InstallDir:C:\\Python"
75+
export PATH="/c/Python36:/c/Python36/Scripts:$PATH"
76+
install_python_packaging python
77+
}
78+
79+
80+
function install_windows_py37 {
81+
choco_install python --version 3.7.5 --params "/InstallDir:C:\\Python"
82+
export PATH="/c/Python37:/c/Python37/Scripts:$PATH"
83+
install_python_packaging python
84+
}
85+
86+
3287
function init_venv {
3388
local py=$1
3489
virtualenv venv --python=$py
35-
. venv/bin/activate
90+
if [ -f venv/Scripts/activate ]; then
91+
. venv/Scripts/activate
92+
else
93+
. venv/bin/activate
94+
fi
3695
}
3796

97+
3898
function update_apt_sources {
3999
wget -qO- https://download.rethinkdb.com/apt/pubkey.gpg | apt-key add -
40100
. /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | tee /etc/apt/sources.list.d/rethinkdb.list
@@ -158,3 +218,4 @@ function install_all {
158218
install_minio
159219
install_chrome_headless
160220
}
221+

pytest-fixture-config/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'Topic :: Utilities',
1414
'Intended Audience :: Developers',
1515
'Operating System :: POSIX',
16+
'Operating System :: Microsoft :: Windows',
1617
'Programming Language :: Python :: 2',
1718
'Programming Language :: Python :: 2.7',
1819
'Programming Language :: Python :: 3',

pytest-git/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'Topic :: Utilities',
1414
'Intended Audience :: Developers',
1515
'Operating System :: POSIX',
16+
'Operating System :: Microsoft :: Windows',
1617
'Programming Language :: Python :: 2',
1718
'Programming Language :: Python :: 2.7',
1819
'Programming Language :: Python :: 3',

pytest-listener/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'Topic :: Utilities',
1414
'Intended Audience :: Developers',
1515
'Operating System :: POSIX',
16+
'Operating System :: Microsoft :: Windows',
1617
'Programming Language :: Python :: 2',
1718
'Programming Language :: Python :: 2.7',
1819
'Programming Language :: Python :: 3',

pytest-virtualenv/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
'Topic :: Utilities',
1414
'Intended Audience :: Developers',
1515
'Operating System :: POSIX',
16+
'Operating System :: Microsoft :: Windows',
1617
'Programming Language :: Python :: 2',
1718
'Programming Language :: Python :: 2.7',
1819
'Programming Language :: Python :: 3',

0 commit comments

Comments
 (0)