]> git.phdru.name Git - ppu.git/commitdiff
Test at Travis and AppVeyor
authorOleg Broytman <phd@phdru.name>
Sat, 29 Apr 2017 13:42:07 +0000 (16:42 +0300)
committerOleg Broytman <phd@phdru.name>
Sat, 29 Apr 2017 14:08:12 +0000 (17:08 +0300)
.travis.yml [new file with mode: 0644]
TODO
appveyor.yml [new file with mode: 0644]
docs/news.rst
tests/test_remove_old_files.py
tox.ini

diff --git a/.travis.yml b/.travis.yml
new file mode 100644 (file)
index 0000000..ddec68a
--- /dev/null
@@ -0,0 +1,30 @@
+# Config file for automatic testing at travis-ci.org
+
+# Only test master and pull requests; skip tags.
+# Other branches can allow themselves.
+branches:
+  only:
+    - master
+
+# Prefer docker containers
+sudo: required
+
+language: python
+
+python:
+  - "3.6"
+
+cache: pip
+
+env:
+  - TOXENV=py27
+  - TOXENV=py33
+  - TOXENV=py34
+  - TOXENV=py35
+  - TOXENV=py36
+
+install:
+  - travis_retry pip install tox
+
+script:
+  - tox
diff --git a/TODO b/TODO
index 5666c9c0b3ff7d08de400a2458353de6ab7e7475..b0fd453ca990efebd9a2f61cdf052a339cdbdc05 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,4 +1,4 @@
-Travis, AppVeyor, PyPI.
+PyPI.
 
 
 Add option -v/--verbose to report every removed file.
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644 (file)
index 0000000..859db9b
--- /dev/null
@@ -0,0 +1,75 @@
+# Test on windows
+# Heavily inspired by Oliver Grisel's appveyor-demo (https://github.com/ogrisel/python-appveyor-demo)
+version: '{branch}-{build}'
+
+# Only test master and pull requests; skip tags.
+# Other branches can allow themselves.
+branches:
+  only:
+    - master
+skip_branch_with_pr: false
+skip_tags: true
+
+cache:
+  - '%LOCALAPPDATA%\pip\Cache'
+
+# Match travis
+clone_depth: 50
+
+environment:
+  matrix:
+    - PYTHON_HOME: "C:\\Python27"
+      PYTHON_VERSION: "2.7"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py27"
+    - PYTHON_HOME: "C:\\Python27-x64"
+      PYTHON_VERSION: "2.7"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py27"
+    - PYTHON_HOME: "C:\\Python33"
+      PYTHON_VERSION: "3.3"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py33"
+    - PYTHON_HOME: "C:\\Python33-x64"
+      PYTHON_VERSION: "3.3"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py33"
+    - PYTHON_HOME: "C:\\Python34"
+      PYTHON_VERSION: "3.4"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py34"
+    - PYTHON_HOME: "C:\\Python34-x64"
+      PYTHON_VERSION: "3.4"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py34"
+    - PYTHON_HOME: "C:\\Python35"
+      PYTHON_VERSION: "3.5"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py35"
+    - PYTHON_HOME: "C:\\Python35-x64"
+      PYTHON_VERSION: "3.5"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py35"
+    - PYTHON_HOME: "C:\\Python36"
+      PYTHON_VERSION: "3.6"
+      PYTHON_ARCH: "32"
+      TOX_ENV: "py36"
+    - PYTHON_HOME: "C:\\Python36-x64"
+      PYTHON_VERSION: "3.6"
+      PYTHON_ARCH: "64"
+      TOX_ENV: "py36"
+
+install:
+  # Ensure we use the right python version
+  - "SET PATH=%PYTHON_HOME%;%PYTHON_HOME%\\Scripts;%PATH%"
+  - "SET TOXPYTHON=%PYTHON_HOME%\\python.exe"
+  - "python --version"
+  - "python -c \"import struct; print(struct.calcsize('P') * 8)\""
+  - "pip --version"
+  - "pip install tox"
+
+# No build step - _namemapper extension will be built under tox
+build: false
+
+test_script:
+  - "tox -e %TOX_ENV%"
index 45a3f5a54334778e394fd47519e1767dd147b31a..8642710dc1680700268dd92e6057930d93b45cb0 100644 (file)
@@ -1,6 +1,11 @@
 News
 ====
 
+Version 0.2.0 (2017-05-??)
+--------------------------
+
+* Test at Travis and AppVeyor.
+
 0.1.0 (2017-04-16)
 ------------------
 
index 67da601952463f0c5379af8614b0b371aa7332f7..87fc3e319bdb60e5ad8a9937ec3bbd102ab97d72 100755 (executable)
@@ -1,11 +1,19 @@
 #! /usr/bin/env python
 
-import shutil
 import os
+import shutil
+import sys
 from tempfile import mkdtemp
 
 
 tmp_dir = None
+for path in os.environ["PATH"].split(os.pathsep):
+    path = path.strip('"')
+    test_prog_path = os.path.join(path, 'remove-old-files.py')
+    if os.path.exists(test_prog_path):
+        break
+else:
+    sys.exit("Cannot find remove-old-files.py in %s" % os.environ["PATH"])
 
 
 def setup():
@@ -47,7 +55,8 @@ def test_remove_old_files():
     create_files(['test1', 'test2'])
     assert_files_exist(['test1', 'test2'])
     os.utime('test2', (0, 0))
-    assert os.system("remove-old-files.py --older 100 .") == 0
+    assert os.system(
+        "%s %s --older 100 ." % (sys.executable, test_prog_path)) == 0
     assert_files_exist('test1')
     assert_files_not_exist('test2')
 
@@ -58,7 +67,8 @@ def test_recursive():
     test4 = os.path.join('subdir', 'test4')
     assert_files_exist([test3, test4])
     os.utime(test4, (0, 0))
-    assert os.system("remove-old-files.py --older 100 .") == 0
+    assert os.system(
+        "%s %s --older 100 ." % (sys.executable, test_prog_path)) == 0
     assert_files_exist(test3)
     assert_files_not_exist(test4)
 
@@ -70,8 +80,10 @@ def test_remove_empty_directory():
     assert_files_exist([test3, test4])
     os.utime(test3, (0, 0))
     os.utime(test4, (0, 0))
-    assert os.system("remove-old-files.py --older 100 .") == 0
+    assert os.system(
+        "%s %s --older 100 ." % (sys.executable, test_prog_path)) == 0
     assert_files_exist('subdir')
     assert_files_not_exist([test3, test4])
-    assert os.system("remove-old-files.py -e --older 100 .") == 0
+    assert os.system(
+        "%s %s -e --older 100 ." % (sys.executable, test_prog_path)) == 0
     assert_files_not_exist('subdir')
diff --git a/tox.ini b/tox.ini
index 18cfb293ce66b152279606911d1b64fa647f68bd..c32d7b62c74511fe2e09df892fc09464419a7f5a 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -1,10 +1,19 @@
 [tox]
 minversion = 1.8
-toxworkdir={homedir}/.tox/remove-old-files
 envlist = {py26,py27,py33,py34,py35,py36},{py27,py34}-flake8
 
 # Base test environment settings
 [testenv]
+basepython =
+    py26: {env:TOXPYTHON:python2.6}
+    py27: {env:TOXPYTHON:python2.7}
+    py33: {env:TOXPYTHON:python3.3}
+    py34: {env:TOXPYTHON:python3.4}
+    py35: {env:TOXPYTHON:python3.5}
+    py36: {env:TOXPYTHON:python3.6}
+commands =
+    {envpython} --version
+    {envpython} -c "import struct; print(struct.calcsize('P') * 8)"
 deps =
     pytest
     pytest-cov
@@ -15,23 +24,48 @@ whitelist_externals =
 
 [general]
 commands =
-    python -m pytest
+    {envpython} -m pytest
 
 [testenv:py26]
-commands = {[general]commands}
+commands =
+    {[testenv]commands}
+    {[general]commands}
 
 [testenv:py27]
-commands = {[general]commands}
+commands =
+    {[testenv]commands}
+    {[general]commands}
+
+[testenv:py33]
+commands =
+    {[testenv]commands}
+    {[general]commands}
 
 [testenv:py34]
-commands = {[general]commands}
+commands =
+    {[testenv]commands}
+    {[general]commands}
+
+[testenv:py35]
+commands =
+    {[testenv]commands}
+    {[general]commands}
+
+[testenv:py36]
+commands =
+    {[testenv]commands}
+    {[general]commands}
 
 [testenv:py27-flake8]
 deps =
     flake8
-commands = flake8
+commands =
+    {[testenv]commands}
+    flake8
 
 [testenv:py34-flake8]
 deps =
     flake8
-commands = flake8
+commands =
+    {[testenv]commands}
+    flake8