Add a single test project and set to build on travis/appveyor

This commit is contained in:
Joe Rickerby
2017-03-20 23:54:29 +00:00
parent 095a857dcf
commit 309a2adcda
6 changed files with 91 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
matrix:
include:
- sudo: required
services:
- docker
- os: osx
script:
- pip install .
- python ./run_tests.py
+3
View File
@@ -0,0 +1,3 @@
build_script:
- pip install .
- python ./run_tests.py
+20
View File
@@ -0,0 +1,20 @@
from __future__ import print_function
import os, sys, subprocess
from glob import glob
# move cwd to the project root
os.chdir(os.path.dirname(os.path.abspath(__file__)))
test_projects = glob('test/??_*')
if len(test_projects) == 0:
print('No test projects found. Aborting.', file=sys.stderr)
exit(2)
print('Testing projects:', test_projects)
for project_path in test_projects:
subprocess.check_call(['cibuildwheel', project_path])
print('%s built successfully.' % project_path)
print('%d projects built successfully.' % len(test_projects))
+7
View File
@@ -0,0 +1,7 @@
from setuptools import setup, Extension
setup(
name="spam",
ext_modules=[Extension('spam', sources=['spam.c'])],
version="0.1.0",
)
+48
View File
@@ -0,0 +1,48 @@
#include <Python.h>
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(pyinstrument_cext)
{
PyObject* m;
MOD_DEF(m,
"spam",
"Example module",
module_methods,
-1)
MOD_RETURN(m)
}
+3
View File
@@ -0,0 +1,3 @@
This folder contains repos that are built by cibuildwheel to test cibuildwheel. Confusing, I know.
Basically, if cibuildwheel can build these projects, we're good.