--- /dev/null
+# Only test master and pull requests; skip tags.
+# Other branches can allow themselves.
+branches:
+ only:
+ - master
+
+# Prefer docker containers
+sudo: required
+
+language: python
+
+python:
+ - "2.7"
+
+cache: pip
+
+matrix:
+ include:
+ - python: "2.7"
+ env: TOXENV=py27
+ - python: "3.4"
+ env: TOXENV=py34
+ - python: "3.5"
+ env: TOXENV=py35
+ - python: "3.6"
+ env: TOXENV=py36
+ - python: "2.7"
+ env: TOXENV=py27-flake8
+ - python: "3.4"
+ env: TOXENV=py34-flake8
+
+install:
+ - travis_retry pip install --upgrade pip setuptools tox ppu
+
+script:
+ - tox
+
+before_cache:
+ - remove-old-files.py -o 180 ~/.cache/pip
-GitHub, Travis, AppVeyor, PyPI.
+PyPI.
Import from SQL instead of INPX. Import annotations and illustrations.
--- /dev/null
+# 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:
+ global:
+ # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the
+ # /E:ON and /V:ON options are not enabled in the batch script intepreter
+ # See: http://stackoverflow.com/a/13751649/163740
+ CMD_IN_ENV: "cmd /E:ON /V:ON /C devscripts\\CI\\run_with_env.cmd"
+
+ matrix:
+ - TOXENV: "py27-sqlite-w32"
+ PYTHON_VERSION: "2.7"
+ PYTHON_ARCH: "32"
+ PYTHON_HOME: "C:\\Python27"
+ - TOXENV: "py36-sqlite-w32"
+ PYTHON_VERSION: "3.6"
+ PYTHON_ARCH: "32"
+ PYTHON_HOME: "C:\\Python36"
+ - TOXENV: "py36-sqlite-w32"
+ PYTHON_VERSION: "3.6"
+ PYTHON_ARCH: "64"
+ PYTHON_HOME: "C:\\Python36-x64"
+
+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)\""
+ - "python -m pip install --upgrade pip setuptools"
+ - "pip install --upgrade tox ppu"
+ - "pip --version"
+
+# No build step
+build: false
+
+test_script:
+ - "%CMD_IN_ENV% tox"
+
+after_test:
+ - remove-old-files.py -o 180 %LOCALAPPDATA%\\pip\\Cache
--- /dev/null
+:: To build extensions for 64 bit Python 3, we need to configure environment
+:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of:
+:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1)
+::
+:: To build extensions for 64 bit Python 2, we need to configure environment
+:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of:
+:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0)
+::
+:: 32 bit builds, and 64-bit builds for 3.5 and beyond, do not require specific
+:: environment configurations.
+::
+:: Note: this script needs to be run with the /E:ON and /V:ON flags for the
+:: cmd interpreter, at least for (SDK v7.0)
+::
+:: More details at:
+:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows
+:: http://stackoverflow.com/a/13751649/163740
+::
+:: Author: Olivier Grisel
+:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/
+::
+:: Notes about batch files for Python people:
+::
+:: Quotes in values are literally part of the values:
+:: SET FOO="bar"
+:: FOO is now five characters long: " b a r "
+:: If you don't want quotes, don't include them on the right-hand side.
+::
+:: The CALL lines at the end of this file look redundant, but if you move them
+:: outside of the IF clauses, they do not run properly in the SET_SDK_64==Y
+:: case, I don't know why.
+@ECHO OFF
+
+SET COMMAND_TO_RUN=%*
+SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows
+SET WIN_WDK=c:\Program Files (x86)\Windows Kits\10\Include\wdf
+
+:: Extract the major and minor versions, and allow for the minor version to be
+:: more than 9. This requires the version number to have two dots in it.
+SET MAJOR_PYTHON_VERSION=%PYTHON_VERSION:~0,1%
+IF "%PYTHON_VERSION:~3,1%" == "." (
+ SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,1%
+) ELSE (
+ SET MINOR_PYTHON_VERSION=%PYTHON_VERSION:~2,2%
+)
+
+:: Based on the Python version, determine what SDK version to use, and whether
+:: to set the SDK for 64-bit.
+IF %MAJOR_PYTHON_VERSION% == 2 (
+ SET WINDOWS_SDK_VERSION="v7.0"
+ SET SET_SDK_64=Y
+) ELSE (
+ IF %MAJOR_PYTHON_VERSION% == 3 (
+ SET WINDOWS_SDK_VERSION="v7.1"
+ IF %MINOR_PYTHON_VERSION% LEQ 4 (
+ SET SET_SDK_64=Y
+ ) ELSE (
+ SET SET_SDK_64=N
+ IF EXIST "%WIN_WDK%" (
+ :: See: https://connect.microsoft.com/VisualStudio/feedback/details/1610302/
+ REN "%WIN_WDK%" 0wdf
+ )
+ )
+ ) ELSE (
+ ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%"
+ EXIT 1
+ )
+)
+
+IF %PYTHON_ARCH% == 64 (
+ IF %SET_SDK_64% == Y (
+ ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture
+ SET DISTUTILS_USE_SDK=1
+ SET MSSdk=1
+ "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION%
+ "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release
+ ECHO Executing: %COMMAND_TO_RUN%
+ call %COMMAND_TO_RUN% || EXIT 1
+ ) ELSE (
+ ECHO Using default MSVC build environment for 64 bit architecture
+ ECHO Executing: %COMMAND_TO_RUN%
+ call %COMMAND_TO_RUN% || EXIT 1
+ )
+) ELSE (
+ ECHO Using default MSVC build environment for 32 bit architecture
+ ECHO Executing: %COMMAND_TO_RUN%
+ call %COMMAND_TO_RUN% || EXIT 1
+)
--- /dev/null
+# flake8: noqa
+# Skip testing the entire module: names here are imported for pytest
+
+from sqlobject.conftest import \
+ pytest_addoption, pytest_configure, setup_tests
import os
+from sqlobject.tests.dbtest import getConnection
from m_librarian.db import open_db, init_db
from m_librarian.inp import import_inpx
def setup_module():
- try:
- os.remove('/tmp/m_librarian-test.sqlite')
- except OSError:
- pass
- open_db('sqlite:///tmp/m_librarian-test.sqlite')
+ connection = getConnection()
+ if connection.dbName == 'sqlite':
+ try:
+ connection.dropDatabase()
+ except OSError:
+ pass
+ open_db(connection.uri())
init_db()
def teardown_module():
- try:
- os.remove('/tmp/m_librarian-test.sqlite')
- except OSError:
- pass
+ connection = getConnection()
+ if connection.dbName == 'sqlite':
+ try:
+ connection.dropDatabase()
+ except OSError:
+ pass
def load_inpx(inpx):
[tox]
-minversion = 1.8
-toxworkdir={homedir}/.tox/m_librarian
+minversion = 2.0
envlist = {py27,py34,py35,py36},{py27,py34}-flake8
# Base test environment settings
[testenv]
+basepython =
+ py27: {env:TOXPYTHON:python2.7}
+ 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 =
-rdevscripts/requirements/requirements_tests.txt
-sitepackages = True
+passenv = CI TRAVIS TRAVIS_* APPVEYOR DISTUTILS_USE_SDK MSSdk INCLUDE LIB WINDIR
+platform = linux
[general]
commands =
- python -m pytest --cov=m_librarian
+ {[testenv]commands}
+ -rm.py -f /tmp/test.sqdb
+ {envpython} -m pytest --cov=m_librarian -D sqlite:///tmp/test.sqdb
[testenv:py27]
commands = {[general]commands}
[testenv:py36]
commands = {[general]commands}
+[sqlite-w32]
+platform = win32
+commands =
+ {[testenv]commands}
+ -rm.py -f C:/projects/m-librarian/test.sqdb
+ pytest --cov=m_librarian -D sqlite:/C:/projects/m-librarian/test.sqdb?debug=1
+ rm.py -f C:/projects/m-librarian/test.sqdb
+
+[testenv:py27-sqlite-w32]
+platform = win32
+commands = {[sqlite-w32]commands}
+
+[testenv:py34-sqlite-w32]
+platform = win32
+commands = {[sqlite-w32]commands}
+
+[testenv:py35-sqlite-w32]
+platform = win32
+commands = {[sqlite-w32]commands}
+
+[testenv:py36-sqlite-w32]
+platform = win32
+commands = {[sqlite-w32]commands}
+
+# flake8
[testenv:py27-flake8]
deps =
flake8
-commands = flake8
+commands =
+ {[testenv]commands}
+ flake8
[testenv:py34-flake8]
deps =
flake8
-commands = flake8
+commands =
+ {[testenv]commands}
+ flake8