--- /dev/null
+# 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:\\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%"
--- /dev/null
+#! /usr/bin/env python
+"""cmp.py: compare two files. Portable replacement for cmp."""
+
+import os
+import sys
+
+if sys.argv[1] in ("-h", "--help"):
+ print("Broytman cmp.py 1.0, Copyright (C) 2003-2017 PhiloSoft Design")
+ print("Usage: cmp.py [-h|--help|-V|--version] [-i] file1 file2")
+ sys.exit()
+elif sys.argv[1] in ("-V", "--version"):
+ print("Broytman cmp.py 1.0, Copyright (C) 2003-2017 PhiloSoft Design")
+ sys.exit()
+elif sys.argv[1] == "-i":
+ show_pbar = False
+ fname1 = sys.argv[2]
+ fname2 = sys.argv[3]
+else:
+ show_pbar = sys.stderr.isatty()
+ fname1 = sys.argv[1]
+ fname2 = sys.argv[2]
+
+if show_pbar:
+ try:
+ from m_lib.pbar.tty_pbar import ttyProgressBar
+ except ImportError:
+ show_pbar = 0
+
+if show_pbar:
+ try:
+ size = os.path.getsize(fname1)
+ except:
+ print(fname1, ": no such file")
+ sys.exit(1)
+
+if show_pbar:
+ pbar = ttyProgressBar(0, size)
+
+file1 = open(fname1, 'rb')
+file2 = open(fname2, 'rb')
+
+M = 1024*1024
+diff = False
+count = 0
+
+
+def report():
+ if show_pbar:
+ global pbar
+ del pbar
+ sys.stderr.write("Files differ at %d megabayte block\n" % count)
+ global diff
+ diff = True
+
+
+while True:
+ block1 = file1.read(M)
+ block2 = file2.read(M)
+
+ if show_pbar:
+ pbar.display(file1.tell())
+
+ if block1 and block2:
+ if len(block1) != len(block2):
+ report()
+ break
+ elif block1:
+ report()
+ break
+ elif block2:
+ report()
+ break
+ else:
+ break
+
+ if block1 != block2:
+ report()
+ break
+
+ count += 1
+
+if show_pbar and not diff:
+ del pbar
+
+file1.close()
+file2.close()
+
+if diff:
+ sys.exit(1)
--- /dev/null
+#! /usr/bin/env python
+
+import os
+import sys
+
+for filename in sys.argv[1:]:
+ os.unlink(filename)
* Python 3.5, 3.6.
-* Test at Travis.
+* Test at Travis and AppVeyor.
Version 0.1.2 (2017-04-27)
--------------------------
setup(name='sqlconvert',
version=__version__,
description='Broytman sqlconvert',
- long_description=open('README.txt', 'rtU').read(),
+ long_description=open('README.txt', 'rU').read(),
author='Oleg Broytman',
author_email='phd@phdru.name',
url='http://phdru.name/Software/Python/',
# 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 =
sqlparse
pytest
flake8
createdb
dropdb
- cmp
- rm
[general]
commands =
+ {[testenv]commands}
{envpython} -m pytest --cov=sqlconvert
- mysql2sql demo/demo.sql test.out
- cmp -s tests/mysql2sql/test.out test.out
- rm test.out
+ {envpython} {envbindir}/mysql2sql -P demo/demo.sql test.out
+ {envpython} devscripts/cmp.py -i tests/mysql2sql/test.out test.out
+ {envpython} devscripts/rm.py test.out
[testenv:py26]
commands = {[general]commands}
# PostgreSQL test environments
[postgresql]
commands =
+ {[testenv]commands}
-dropdb test
createdb test
{envpython} -m pytest --cov=sqlconvert -D postgres:///test
# SQLite test environments
[sqlite]
commands =
+ {[testenv]commands}
{envpython} -m pytest --cov=sqlconvert -D sqlite:///tmp/test.sqdb
- rm -f /tmp/test.sqdb
+ {envpython} devscripts/rm.py /tmp/test.sqdb
[testenv:py26-sqlite]
commands = {[sqlite]commands}
[testenv:py27-flake8]
deps =
flake8
-commands = flake8
+commands =
+ {[testenv]commands}
+ flake8
[testenv:py34-flake8]
deps =
flake8
-commands = flake8
+commands =
+ {[testenv]commands}
+ flake8