diff --git a/test/old/01_basic/cibuildwheel_test.py b/test/old/01_basic/cibuildwheel_test.py deleted file mode 100644 index d8deee4f..00000000 --- a/test/old/01_basic/cibuildwheel_test.py +++ /dev/null @@ -1,39 +0,0 @@ -import os -import platform -import textwrap - -import utils - -project_dir = os.path.dirname(__file__) - -project_spec = TemplateProjectC( - setup_py_add=textwrap.dedent(''' - import os - if os.environ.get("CIBUILDWHEEL", "0") != "1": - raise Exception("CIBUILDWHEEL environment variable is not set to 1") - ''') -) - - -def test(): - # build the wheels - actual_wheels = utils.cibuildwheel_run(project_dir) - - # check that the expected wheels are produced - expected_wheels = utils.expected_wheels('spam', '0.1.0') - assert set(actual_wheels) == set(expected_wheels) - - -def test_build_identifiers(): - # check that the number of expected wheels matches the number of build - # identifiers - # after adding CIBW_MANYLINUX_IMAGE to support manylinux2010, there - # can be multiple wheels for each wheel, though, so we need to limit - # the expected wheels - if platform.machine() in ['x86_64', 'i686']: - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') - if '-manylinux' not in w or '-manylinux1' in w] - else: - expected_wheels = utils.expected_wheels('spam', '0.1.0') - build_identifiers = utils.cibuildwheel_get_build_identifiers(project_dir) - assert len(expected_wheels) == len(build_identifiers) diff --git a/test/old/01_basic/setup.py b/test/old/01_basic/setup.py deleted file mode 100644 index 83f6d53d..00000000 --- a/test/old/01_basic/setup.py +++ /dev/null @@ -1,15 +0,0 @@ -import os - -from setuptools import ( - Extension, - setup, -) - -if os.environ.get('CIBUILDWHEEL', '0') != '1': - raise Exception('CIBUILDWHEEL environment variable is not set to 1') - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/01_basic/spam.c b/test/old/01_basic/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/01_basic/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/02_test/cibuildwheel_test.py b/test/old/02_test/cibuildwheel_test.py deleted file mode 100644 index 21878d2c..00000000 --- a/test/old/02_test/cibuildwheel_test.py +++ /dev/null @@ -1,55 +0,0 @@ -import os -import subprocess - -import pytest - -import utils - - -def test(): - project_dir = os.path.dirname(__file__) - - # build and test the wheels - actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ - 'CIBW_TEST_REQUIRES': 'nose', - # the 'false ||' bit is to ensure this command runs in a shell on - # mac/linux. - 'CIBW_TEST_COMMAND': 'false || nosetests {project}/test', - 'CIBW_TEST_COMMAND_WINDOWS': 'COLOR 00 || nosetests {project}/test', - }) - - # also check that we got the right wheels - expected_wheels = utils.expected_wheels('spam', '0.1.0') - assert set(actual_wheels) == set(expected_wheels) - - -def test_extras_require(): - project_dir = os.path.dirname(__file__) - - # build and test the wheels - actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ - 'CIBW_TEST_EXTRAS': 'test', - # the 'false ||' bit is to ensure this command runs in a shell on - # mac/linux. - 'CIBW_TEST_COMMAND': 'false || nosetests {project}/test', - 'CIBW_TEST_COMMAND_WINDOWS': 'COLOR 00 || nosetests {project}/test', - }) - - # also check that we got the right wheels - expected_wheels = utils.expected_wheels('spam', '0.1.0') - assert set(actual_wheels) == set(expected_wheels) - - -def test_failing_test(tmp_path): - '''Ensure a failing test causes cibuildwheel to error out and exit''' - project_dir = os.path.dirname(__file__) - - with pytest.raises(subprocess.CalledProcessError): - utils.cibuildwheel_run(project_dir, output_dir=tmp_path, add_env={ - 'CIBW_TEST_COMMAND': 'false', - # manylinux1 has a version of bash that's been shown to have - # problems with this, so let's check that. - 'CIBW_MANYLINUX_I686_IMAGE': 'manylinux1', - 'CIBW_MANYLINUX_X86_64_IMAGE': 'manylinux1', - }) - assert len(os.listdir(str(tmp_path))) == 0 diff --git a/test/old/02_test/setup.py b/test/old/02_test/setup.py deleted file mode 100644 index 3a150b3d..00000000 --- a/test/old/02_test/setup.py +++ /dev/null @@ -1,11 +0,0 @@ -from setuptools import ( - Extension, - setup, -) - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - extras_require={'test': ['nose']}, - version="0.1.0", -) diff --git a/test/old/02_test/spam.c b/test/old/02_test/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/02_test/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/02_test/test/spam_test.py b/test/old/02_test/test/spam_test.py deleted file mode 100644 index ba5f5e91..00000000 --- a/test/old/02_test/test/spam_test.py +++ /dev/null @@ -1,45 +0,0 @@ -from __future__ import print_function -import os -import sys -from unittest import TestCase - -import spam - - -def path_contains(parent, child): - ''' returns True if `child` is inside `parent`. - - Works around path-comparison bugs caused by short-paths on Windows e.g. - vssadm~1 instead of vssadministrator - ''' - parent = os.path.abspath(parent) - child = os.path.abspath(child) - - while child != os.path.dirname(child): - child = os.path.dirname(child) - if os.stat(parent) == os.stat(child): - # parent and child refer to the same directory on the filesystem - return True - return False - - -class TestSpam(TestCase): - def test_system(self): - self.assertEqual(0, spam.system('python -c "exit(0)"')) - self.assertNotEqual(0, spam.system('python -c "exit(1)"')) - - def test_virtualenv(self): - virtualenv_path = os.environ.get("__CIBW_VIRTUALENV_PATH__") - if not virtualenv_path: - self.fail("No virtualenv path defined in environment variable __CIBW_VIRTUALENV_PATH__") - - print("=[executable]", sys.executable) - print("=[spam location]", spam.__file__) - print("=[virtualenv path]", virtualenv_path) - print("=[listdir]", os.listdir(virtualenv_path)) - if os.path.exists(os.path.join(virtualenv_path, 'Scripts')): - print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'Scripts'))) - if os.path.exists(os.path.join(virtualenv_path, 'bin')): - print("=[listdir]2", os.listdir(os.path.join(virtualenv_path, 'bin'))) - self.assertTrue(path_contains(virtualenv_path, sys.executable)) - self.assertTrue(path_contains(virtualenv_path, spam.__file__)) diff --git a/test/old/03_before_build/cibuildwheel_test.py b/test/old/03_before_build/cibuildwheel_test.py deleted file mode 100644 index 8b0bfcb6..00000000 --- a/test/old/03_before_build/cibuildwheel_test.py +++ /dev/null @@ -1,19 +0,0 @@ -import os - -import utils - - -def test(): - project_dir = os.path.dirname(__file__) - - # build the wheels - actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ - # write python version information to a temporary file, this is - # checked in setup.py - 'CIBW_BEFORE_BUILD': '''python -c "import sys; open('/tmp/pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('/tmp/pythonexecutable.txt', 'w').write(sys.executable)"''', - 'CIBW_BEFORE_BUILD_WINDOWS': '''python -c "import sys; open('c:\\pythonversion.txt', 'w').write(sys.version)" && python -c "import sys; open('c:\\pythonexecutable.txt', 'w').write(sys.executable)"''', - }) - - # also check that we got the right wheels - expected_wheels = utils.expected_wheels('spam', '0.1.0') - assert set(actual_wheels) == set(expected_wheels) diff --git a/test/old/03_before_build/setup.py b/test/old/03_before_build/setup.py deleted file mode 100644 index fd78c005..00000000 --- a/test/old/03_before_build/setup.py +++ /dev/null @@ -1,31 +0,0 @@ -import os -import sys - -from setuptools import ( - Extension, - setup, -) - -# assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_BUILD step -# is the same one as is currently running. -version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt' -with open(version_file) as f: - stored_version = f.read() -print('stored_version', stored_version) -print('sys.version', sys.version) -assert stored_version == sys.version - -# check that the executable also was written -executable_file = 'c:\\pythonexecutable.txt' if sys.platform == 'win32' else '/tmp/pythonexecutable.txt' -with open(executable_file) as f: - stored_executable = f.read() -print('stored_executable', stored_executable) -print('sys.executable', sys.executable) -# windows/mac are case insensitive -assert os.path.realpath(stored_executable).lower() == os.path.realpath(sys.executable).lower() - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/03_before_build/spam.c b/test/old/03_before_build/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/03_before_build/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/04_build_skip/cibuildwheel_test.py b/test/old/04_build_skip/cibuildwheel_test.py deleted file mode 100644 index 2c6a622c..00000000 --- a/test/old/04_build_skip/cibuildwheel_test.py +++ /dev/null @@ -1,18 +0,0 @@ -import os - -import utils - - -def test(): - project_dir = os.path.dirname(__file__) - - # build the wheels - actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ - 'CIBW_BUILD': 'cp3?-*', - 'CIBW_SKIP': 'cp37-*', - }) - - # check that we got the right wheels. There should be no 2.7 or 3.7. - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') - if ('-cp3' in w) and ('-cp37' not in w)] - assert set(actual_wheels) == set(expected_wheels) diff --git a/test/old/04_build_skip/setup.py b/test/old/04_build_skip/setup.py deleted file mode 100644 index 2e3fd5c6..00000000 --- a/test/old/04_build_skip/setup.py +++ /dev/null @@ -1,18 +0,0 @@ -import sys - -from setuptools import ( - Extension, - setup, -) - -# explode if run on Python 2.7 or Python 3.4 (these should be skipped) -if sys.version_info[0:2] == (2, 7): - raise Exception('Python 2.7 should not be built') -if sys.version_info[0:2] == (3, 4): - raise Exception('Python 3.4 should be skipped') - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/04_build_skip/spam.c b/test/old/04_build_skip/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/04_build_skip/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/05_environment/cibuildwheel_test.py b/test/old/05_environment/cibuildwheel_test.py deleted file mode 100644 index ab467111..00000000 --- a/test/old/05_environment/cibuildwheel_test.py +++ /dev/null @@ -1,32 +0,0 @@ -import os -import pytest -import subprocess -import utils - - -def test(): - project_dir = os.path.dirname(__file__) - - # write some information into the CIBW_ENVIRONMENT, for expansion and - # insertion into the environment by cibuildwheel. This is checked - # in setup.py - actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ - 'CIBW_ENVIRONMENT': '''CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH=$PATH:/opt/cibw_test_path''', - 'CIBW_ENVIRONMENT_WINDOWS': '''CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH="$PATH;/opt/cibw_test_path"''', - }) - - # also check that we got the right wheels built - expected_wheels = utils.expected_wheels('spam', '0.1.0') - assert set(actual_wheels) == set(expected_wheels) - - -def test_overridden_path(tmp_path): - project_dir = os.path.dirname(__file__) - - # mess up PATH, somehow - with pytest.raises(subprocess.CalledProcessError): - utils.cibuildwheel_run(project_dir, output_dir=tmp_path, add_env={ - 'CIBW_ENVIRONMENT': '''SOMETHING="$(mkdir new_path && touch new_path/python)" PATH="$(realpath new_path):$PATH"''', - 'CIBW_ENVIRONMENT_WINDOWS': '''SOMETHING="$(mkdir new_path && type nul > new_path/python.exe)" PATH="$CD\\new_path;$PATH"''', - }) - assert len(os.listdir(str(tmp_path))) == 0 diff --git a/test/old/05_environment/setup.py b/test/old/05_environment/setup.py deleted file mode 100644 index da5e8d59..00000000 --- a/test/old/05_environment/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -import os - -from setuptools import ( - Extension, - setup, -) - -# explode if environment isn't correct, as set in CIBW_ENVIRONMENT -CIBW_TEST_VAR = os.environ.get('CIBW_TEST_VAR') -CIBW_TEST_VAR_2 = os.environ.get('CIBW_TEST_VAR_2') -PATH = os.environ.get('PATH') - -if CIBW_TEST_VAR != 'a b c': - raise Exception('CIBW_TEST_VAR should equal "a b c". It was "%s"' % CIBW_TEST_VAR) -if CIBW_TEST_VAR_2 != '1': - raise Exception('CIBW_TEST_VAR_2 should equal "1". It was "%s"' % CIBW_TEST_VAR_2) -if '/opt/cibw_test_path' not in PATH: - raise Exception('PATH should contain "/opt/cibw_test_path". It was "%s"' % PATH) -if '$PATH' in PATH: - raise Exception('$PATH should be expanded in PATH. It was "%s"' % PATH) - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/05_environment/spam.c b/test/old/05_environment/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/05_environment/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/06_docker_images/cibuildwheel_test.py b/test/old/06_docker_images/cibuildwheel_test.py deleted file mode 100644 index 7be4a4c3..00000000 --- a/test/old/06_docker_images/cibuildwheel_test.py +++ /dev/null @@ -1,26 +0,0 @@ -import os -import platform - -import pytest - -import utils - - -def test(): - project_dir = os.path.dirname(__file__) - - if utils.platform != 'linux': - pytest.skip('the test is only relevant to the linux build') - if platform.machine() not in ['x86_64', 'i686']: - pytest.skip('this test is currently only possible on x86_64/i686 due to availability of alternative images') - - actual_wheels = utils.cibuildwheel_run(project_dir, add_env={ - 'CIBW_MANYLINUX_X86_64_IMAGE': 'dockcross/manylinux2010-x64', - 'CIBW_MANYLINUX_I686_IMAGE': 'dockcross/manylinux2010-x86', - 'CIBW_SKIP': 'pp*', - }) - - # also check that we got the right wheels built - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') - if '-pp' not in w] - assert set(actual_wheels) == set(expected_wheels) diff --git a/test/old/06_docker_images/setup.py b/test/old/06_docker_images/setup.py deleted file mode 100644 index 5680349d..00000000 --- a/test/old/06_docker_images/setup.py +++ /dev/null @@ -1,18 +0,0 @@ -import os -import sys - -from setuptools import ( - Extension, - setup, -) - -# check that we're running in the correct docker image as specified in the -# environment options CIBW_MANYLINUX1_*_IMAGE -if 'linux' in sys.platform and not os.path.exists('/dockcross'): - raise Exception('/dockcross directory not found. Is this test running in the correct docker image?') - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/06_docker_images/spam.c b/test/old/06_docker_images/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/06_docker_images/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/07_ssl/cibuildwheel_test.py b/test/old/07_ssl/cibuildwheel_test.py deleted file mode 100644 index 787ba866..00000000 --- a/test/old/07_ssl/cibuildwheel_test.py +++ /dev/null @@ -1,11 +0,0 @@ -import os - -import utils - - -def test(): - project_dir = os.path.dirname(__file__) - # this test checks that SSL is working in the build environment using - # some checks in setup.py. - - utils.cibuildwheel_run(project_dir) diff --git a/test/old/07_ssl/setup.py b/test/old/07_ssl/setup.py deleted file mode 100644 index 4b6a4f24..00000000 --- a/test/old/07_ssl/setup.py +++ /dev/null @@ -1,24 +0,0 @@ -import ssl -import sys - -from setuptools import ( - Extension, - setup, -) - -if sys.version_info[0] == 2: - from urllib2 import urlopen -else: - from urllib.request import urlopen - -if sys.version_info[0:2] == (3, 3): - data = urlopen('https://www.nist.gov') -else: - context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2) - data = urlopen('https://www.nist.gov', context=context) - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/07_ssl/spam.c b/test/old/07_ssl/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/07_ssl/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/08_manylinuxXXXX_only/cibuildwheel_test.py b/test/old/08_manylinuxXXXX_only/cibuildwheel_test.py deleted file mode 100644 index 2c20441d..00000000 --- a/test/old/08_manylinuxXXXX_only/cibuildwheel_test.py +++ /dev/null @@ -1,44 +0,0 @@ -import os -import platform - -import pytest - -import utils - - -@pytest.mark.parametrize('manylinux_image', ['manylinux1', 'manylinux2010', 'manylinux2014']) -def test(manylinux_image): - project_dir = os.path.dirname(__file__) - - if utils.platform != 'linux': - pytest.skip('the docker test is only relevant to the linux build') - elif platform.machine() not in ['x86_64', 'i686']: - if manylinux_image in ['manylinux1', 'manylinux2010']: - pytest.skip("manylinux1 and 2010 doesn't exist for non-x86 architectures") - - # build the wheels - # CFLAGS environment variable is necessary to fail on 'malloc_info' (on manylinux1) during compilation/linking, - # rather than when dynamically loading the Python - add_env = { - 'CIBW_ENVIRONMENT': 'CFLAGS="$CFLAGS -Werror=implicit-function-declaration"', - 'CIBW_MANYLINUX_X86_64_IMAGE': manylinux_image, - 'CIBW_MANYLINUX_I686_IMAGE': manylinux_image, - 'CIBW_MANYLINUX_PYPY_X86_64_IMAGE': manylinux_image, - 'CIBW_MANYLINUX_AARCH64_IMAGE': manylinux_image, - 'CIBW_MANYLINUX_PPC64LE_IMAGE': manylinux_image, - 'CIBW_MANYLINUX_S390X_IMAGE': manylinux_image, - } - if manylinux_image == 'manylinux1': - # We don't have a manylinux1 image for PyPy - add_env['CIBW_SKIP'] = 'pp*' - elif manylinux_image == 'manylinux2014': - # We don't have a manylinux2014 image for PyPy (yet?) - add_env['CIBW_SKIP'] = 'cp27* pp*' # Python 2.7 not available on manylinux2014 - actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env) - - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0', manylinux_versions=[manylinux_image])] - if manylinux_image == 'manylinux2014': - expected_wheels = [w for w in expected_wheels if '-cp27' not in w] - if manylinux_image in ['manylinux1', 'manylinux2014']: - expected_wheels = [w for w in expected_wheels if '-pp' not in w] - assert set(actual_wheels) == set(expected_wheels) diff --git a/test/old/08_manylinuxXXXX_only/setup.py b/test/old/08_manylinuxXXXX_only/setup.py deleted file mode 100644 index 209f45b0..00000000 --- a/test/old/08_manylinuxXXXX_only/setup.py +++ /dev/null @@ -1,10 +0,0 @@ -from setuptools import ( - Extension, - setup, -) - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/08_manylinuxXXXX_only/spam.c b/test/old/08_manylinuxXXXX_only/spam.c deleted file mode 100644 index 0e7c5597..00000000 --- a/test/old/08_manylinuxXXXX_only/spam.c +++ /dev/null @@ -1,68 +0,0 @@ -#include -#include - -#if !defined(__GLIBC_PREREQ) -#error "Must run on a glibc linux environment" -#endif - -#if !__GLIBC_PREREQ(2, 5) /* manylinux1 is glibc 2.5 */ -#error "Must run on a glibc >= 2.5 linux environment" -#endif - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts = 0; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - -#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 17) /* manylinux2014 is glibc 2.17 */ - // secure_getenv is only available in manylinux2014, ensuring - // that only a manylinux2014 wheel is produced - sts = (int)secure_getenv("NON_EXISTING_ENV_VARIABLE"); -#elif defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10) /* manylinux2010 is glibc 2.12 */ - // malloc_info is only available on manylinux2010+ - sts = malloc_info(0, stdout); -#endif - if (sts == 0) { - sts = system(command); - } - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/09_setup_cfg/cibuildwheel_test.py b/test/old/09_setup_cfg/cibuildwheel_test.py deleted file mode 100644 index b6c3de01..00000000 --- a/test/old/09_setup_cfg/cibuildwheel_test.py +++ /dev/null @@ -1,14 +0,0 @@ -import os - -import utils - -project_dir = os.path.dirname(__file__) - - -def test(): - # build the wheels - actual_wheels = utils.cibuildwheel_run(project_dir) - - # check that the expected wheels are produced - expected_wheels = utils.expected_wheels('spam', '0.1.0') - assert set(actual_wheels) == set(expected_wheels) diff --git a/test/old/09_setup_cfg/setup.cfg b/test/old/09_setup_cfg/setup.cfg deleted file mode 100644 index b42c221a..00000000 --- a/test/old/09_setup_cfg/setup.cfg +++ /dev/null @@ -1,6 +0,0 @@ -[metadata] -name = spam -version = attr: spam.__version__ - -[options] -packages = find: \ No newline at end of file diff --git a/test/old/09_setup_cfg/setup.py b/test/old/09_setup_cfg/setup.py deleted file mode 100644 index a4c19252..00000000 --- a/test/old/09_setup_cfg/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -from setuptools import ( - Extension, - setup, -) - -setup( - ext_modules=[Extension('spam.spam', sources=['spam/spam.c'])], -) diff --git a/test/old/09_setup_cfg/spam/__init__.py b/test/old/09_setup_cfg/spam/__init__.py deleted file mode 100644 index 3dc1f76b..00000000 --- a/test/old/09_setup_cfg/spam/__init__.py +++ /dev/null @@ -1 +0,0 @@ -__version__ = "0.1.0" diff --git a/test/old/09_setup_cfg/spam/spam.c b/test/old/09_setup_cfg/spam/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/09_setup_cfg/spam/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/10_cpp_standards/cibuildwheel_test.py b/test/old/10_cpp_standards/cibuildwheel_test.py deleted file mode 100644 index 72a8f676..00000000 --- a/test/old/10_cpp_standards/cibuildwheel_test.py +++ /dev/null @@ -1,61 +0,0 @@ -import os - -import pytest - -import utils - -project_dir = os.path.dirname(__file__) - - -def test_cpp11(tmp_path): - # This test checks that the C++11 standard is supported - - # VC++ for Python 2.7 does not support modern standards - add_env = {'CIBW_SKIP': 'cp27-win* pp27-win32', 'CIBW_ENVIRONMENT': 'STANDARD=11'} - - actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env) - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') - if 'cp27-cp27m-win' not in w and 'pp27-pypy_73-win32' not in w] - - assert set(actual_wheels) == set(expected_wheels) - - -def test_cpp14(): - # This test checks that the C++14 standard is supported - - # VC++ for Python 2.7 does not support modern standards - # The manylinux1 docker image does not have a compiler which supports C++11 - # Python 3.4 and 3.5 are compiled with MSVC 10, which does not support C++14 - add_env = {'CIBW_SKIP': 'cp27-win* pp27-win32 cp35-win*', 'CIBW_ENVIRONMENT': 'STANDARD=14'} - - actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env) - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0') - if 'cp27-cp27m-win' not in w - and 'pp27-pypy_73-win32' not in w - and 'cp35-cp35m-win' not in w] - - assert set(actual_wheels) == set(expected_wheels) - - -def test_cpp17(): - # This test checks that the C++17 standard is supported - - # Python and PyPy 2.7 use the `register` keyword which is forbidden in the C++17 standard - # The manylinux1 docker image does not have a compiler which supports C++11 - # Python 3.5 and PyPy 3.6 are compiled with MSVC 10, which does not support C++17 - if os.environ.get('APPVEYOR_BUILD_WORKER_IMAGE', '') == 'Visual Studio 2015': - pytest.skip('Visual Studio 2015 does not support C++17') - - add_env = {'CIBW_SKIP': 'cp27-win* pp27-win32 cp35-win* pp36-win32', 'CIBW_ENVIRONMENT': 'STANDARD=17'} - - if utils.platform == 'macos': - add_env['MACOSX_DEPLOYMENT_TARGET'] = '10.13' - - actual_wheels = utils.cibuildwheel_run(project_dir, add_env=add_env) - expected_wheels = [w for w in utils.expected_wheels('spam', '0.1.0', macosx_deployment_target='10.13') - if 'cp27-cp27m-win' not in w - and 'pp27-pypy_73-win32' not in w - and 'cp35-cp35m-win' not in w - and 'pp36-pypy36_pp73-win32' not in w] - - assert set(actual_wheels) == set(expected_wheels) diff --git a/test/old/10_cpp_standards/setup.py b/test/old/10_cpp_standards/setup.py deleted file mode 100644 index f848d0b1..00000000 --- a/test/old/10_cpp_standards/setup.py +++ /dev/null @@ -1,25 +0,0 @@ -import os -import platform - -from setuptools import ( - Extension, - setup, -) - -standard = os.environ["STANDARD"] - -language_standard = "/std:c++" + standard if platform.system() == "Windows" else "-std=c++" + standard - -extra_compile_args = [language_standard, "-DSTANDARD=" + standard] - -if standard == "17": - if platform.system() == "Windows": - extra_compile_args.append("/wd5033") - else: - extra_compile_args.append("-Wno-register") - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.cpp'], language="c++", extra_compile_args=extra_compile_args)], - version="0.1.0", -) diff --git a/test/old/10_cpp_standards/spam.cpp b/test/old/10_cpp_standards/spam.cpp deleted file mode 100644 index f9b56d07..00000000 --- a/test/old/10_cpp_standards/spam.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include - -// Depending on the requested standard, use a modern C++ feature -// that was introduced in that standard. -#if STANDARD == 11 - #include -#elif STANDARD == 14 - int a = 100'000; -#elif STANDARD == 17 - #include - auto a = std::pair(5.0, false); -#else - #error Standard needed -#endif - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/11_before_test/setup.py b/test/old/11_before_test/setup.py deleted file mode 100644 index e3ea2938..00000000 --- a/test/old/11_before_test/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -from setuptools import setup, Extension - - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/11_before_test/spam.c b/test/old/11_before_test/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/11_before_test/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/11_before_test/test/spam_test.py b/test/old/11_before_test/test/spam_test.py deleted file mode 100644 index 21bad8c2..00000000 --- a/test/old/11_before_test/test/spam_test.py +++ /dev/null @@ -1,28 +0,0 @@ -import sys -import os -from unittest import TestCase - - -class TestBeforeTest(TestCase): - def test_version(self): - # assert that the Python version as written to pythonversion.txt in the CIBW_BEFORE_TEST step - # is the same one as is currently running. - # because of use symlinks in MacOS run this test is also need - version_file = 'c:\\pythonversion.txt' if sys.platform == 'win32' else '/tmp/pythonversion.txt' - with open(version_file) as f: - stored_version = f.read() - print('stored_version', stored_version) - print('sys.version', sys.version) - assert stored_version == sys.version - - def test_prefix(self): - # check that the prefix also was written - prefix_file = 'c:\\pythonprefix.txt' if sys.platform == 'win32' else '/tmp/pythonprefix.txt' - with open(prefix_file) as f: - stored_prefix = f.read() - print('stored_prefix', stored_prefix) - print('sys.prefix', sys.prefix) - # Works around path-comparison bugs caused by short-paths on Windows e.g. - # vssadm~1 instead of vssadministrator - - assert os.stat(stored_prefix) == os.stat(sys.prefix) diff --git a/test/old/12_dependency_versions/setup.py b/test/old/12_dependency_versions/setup.py deleted file mode 100644 index 61e4719e..00000000 --- a/test/old/12_dependency_versions/setup.py +++ /dev/null @@ -1,31 +0,0 @@ -import os -import subprocess -from setuptools import ( - Extension, - setup, -) - -versions_output_text = subprocess.check_output( - ['pip', 'freeze', '--all', '-qq'], - universal_newlines=True, -) -versions = versions_output_text.strip().splitlines() - -# `versions` now looks like: -# ['pip==x.x.x', 'setuptools==x.x.x', 'wheel==x.x.x'] - -print('Gathered versions', versions) - -for package_name in ['pip', 'setuptools', 'wheel']: - env_name = 'EXPECTED_{}_VERSION'.format(package_name.upper()) - expected_version = os.environ[env_name] - - assert '{}=={}'.format(package_name, expected_version) in versions, ( - 'error: {} version should equal {}'.format(package_name, expected_version) - ) - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/12_dependency_versions/spam.c b/test/old/12_dependency_versions/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/12_dependency_versions/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/13_subdir_package/bin/before_build.py b/test/old/13_subdir_package/bin/before_build.py deleted file mode 100755 index 3bc8ab16..00000000 --- a/test/old/13_subdir_package/bin/before_build.py +++ /dev/null @@ -1 +0,0 @@ -print('before_build.py executed!') diff --git a/test/old/13_subdir_package/src/spam/setup.py b/test/old/13_subdir_package/src/spam/setup.py deleted file mode 100644 index 637d7ff0..00000000 --- a/test/old/13_subdir_package/src/spam/setup.py +++ /dev/null @@ -1,8 +0,0 @@ -from setuptools import Extension, setup - - -setup( - name="spam", - ext_modules=[Extension('spam', sources=['spam.c'])], - version="0.1.0", -) diff --git a/test/old/13_subdir_package/src/spam/spam.c b/test/old/13_subdir_package/src/spam/spam.c deleted file mode 100644 index d1ab0f22..00000000 --- a/test/old/13_subdir_package/src/spam/spam.c +++ /dev/null @@ -1,48 +0,0 @@ -#include - -static PyObject * -spam_system(PyObject *self, PyObject *args) -{ - const char *command; - int sts; - - if (!PyArg_ParseTuple(args, "s", &command)) - return NULL; - sts = system(command); - return PyLong_FromLong(sts); -} - -/* Module initialization */ - -#if PY_MAJOR_VERSION >= 3 - #define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - static struct PyModuleDef moduledef = { \ - PyModuleDef_HEAD_INIT, name, doc, module_state_size, methods, }; \ - m = PyModule_Create(&moduledef); - #define MOD_RETURN(m) return m; -#else - #define MOD_INIT(name) PyMODINIT_FUNC init##name(void) - #define MOD_DEF(m, name, doc, methods, module_state_size) \ - m = Py_InitModule3(name, methods, doc); - #define MOD_RETURN(m) return; -#endif - -static PyMethodDef module_methods[] = { - {"system", (PyCFunction)spam_system, METH_VARARGS, - "Execute a shell command."}, - {NULL} /* Sentinel */ -}; - -MOD_INIT(spam) -{ - PyObject* m; - - MOD_DEF(m, - "spam", - "Example module", - module_methods, - -1) - - MOD_RETURN(m) -} diff --git a/test/old/13_subdir_package/src/spam/test/run_tests.py b/test/old/13_subdir_package/src/spam/test/run_tests.py deleted file mode 100644 index 8104e1b3..00000000 --- a/test/old/13_subdir_package/src/spam/test/run_tests.py +++ /dev/null @@ -1 +0,0 @@ -print('run_tests.py executed!') diff --git a/test/test_02_testing.py b/test/test_02_testing.py index df2f51be..59dda512 100644 --- a/test/test_02_testing.py +++ b/test/test_02_testing.py @@ -3,7 +3,12 @@ import pytest, textwrap from . import utils from .template_projects import CTemplateProject -project_with_a_test = CTemplateProject() +project_with_a_test = CTemplateProject( + setup_cfg_add=textwrap.dedent(r''' + [options.extras_require] + test = nose + ''') +) project_with_a_test.files['test/spam_test.py'] = r''' from unittest import TestCase diff --git a/test/old/13_subdir_package/cibuildwheel_test.py b/test/test_12_subdir_package.py similarity index 53% rename from test/old/13_subdir_package/cibuildwheel_test.py rename to test/test_12_subdir_package.py index 404811db..bd520110 100644 --- a/test/old/13_subdir_package/cibuildwheel_test.py +++ b/test/test_12_subdir_package.py @@ -1,10 +1,35 @@ import os import utils +from .template_projects.c import spam_c_template +from .template_projects import TemplateProject -project_dir = os.path.dirname(__file__) +subdir_package_project = TemplateProject() + +subdir_package_project.files['src/spam/spam.c'] = spam_c_template + +subdir_package_project.files['src/spam/setup.py'] = r''' +from setuptools import Extension, setup + +setup( + name="spam", + ext_modules=[Extension('spam', sources=['spam.c'])], + version="0.1.0", +) +''' + +subdir_package_project.files['src/spam/test/run_tests.py'] = r''' +print('run_tests.py executed!') +''' + +subdir_package_project.files['bin/before_build.py'] = r''' +print('before_build.py executed!') +''' -def test(capfd): +def test(capfd, tmpdir): + project_dir = str(tmpdir) + subdir_package_project.generate(project_dir) + package_dir = os.path.join(project_dir, 'src', 'spam') # build the wheels actual_wheels = utils.cibuildwheel_run(project_dir, package_dir=package_dir, add_env={