diff --git a/.coveragerc b/.coveragerc index e029911052063154a7d1d3e437104d91bb51f5a3..d5b54ce75ef657c1018e887a3a9f8fa35b4e7e55 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,3 @@ [run] -branch=1 -omit= - tests/* - .eggs/* - setup.py +omit=setup.py plugins = Cython.Coverage diff --git a/.travis.yml b/.travis.yml index 2fa1e778e60c477aafa75860f20b58ccabdd8c56..12addb707b45a69a06a4f1cabb3175db08740030 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,8 @@ before_script: - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build - pip install -r requirements.txt - - pip install pytest mock coverage cython[coverage] pytest-cov - - DEBUG=1 python setup.py build_ext --inplace --force --define CYTHON_TRACE + - pip install pytest coverage pytest-cov + - DEBUG=1 python setup.py install - rm -rf minijson jobs: include: @@ -15,6 +15,7 @@ jobs: script: - pytest --cov=./ --cov-report=xml after_script: + - coverage xml - ./cc-test-reporter after-build -t coverage.py --exit-code ${TRAVIS_TEST_RESULT} diff --git a/Dockerfile b/Dockerfile index 56d662521b1bb431ea8401079bf9d868e9854d0a..7a93d2b57bb9743ca44d88f19f7a4b58e2508964 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,19 +1,13 @@ FROM smokserwis/build:python3 -RUN pip install snakehouse Cython satella pytest +RUN pip install snakehouse Cython satella pytest coverage pytest-cov ENV DEBUG=1 WORKDIR /tmp/compile -ADD minijson /tmp/compile/minijson -ADD setup.py /tmp/compile/setup.py -ADD README.md /tmp/compile/README.md -ADD setup.cfg /tmp/compile/setup.cfg +ADD . /tmp/compile/ RUN python setup.py install +RUN rm -rf minijson -WORKDIR /tmp - -ADD tests /tmp/tests - -CMD ["pytest"] +CMD ["pytest", "--cov=./", "--cov-report=xml"] diff --git a/setup.py b/setup.py index 754a228028e330f323902bf3010cc1cc5799f265..51baa21d5a965a8dc8d8eb26b95daaeb4b53cc89 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,14 @@ import os from setuptools import find_packages from distutils.core import setup -from snakehouse import Multibuild, build, find_pyx +from snakehouse import Multibuild, build, monkey_patch_parallel_compilation, find_pyx + +monkey_patch_parallel_compilation() build_kwargs = {} directives = {'language_level': '3'} dont_snakehouse = False - +multi_kwargs = {} if 'DEBUG' in os.environ: print('Enabling debug mode') dont_snakehouse = True @@ -15,6 +17,8 @@ if 'DEBUG' in os.environ: profile=True, linetrace=True, binding=True) + multi_kwargs['define_macros'] = [('CYTHON_TRACE', '1'), + ('CYTHON_TRACE_NOGIL', '1')] import Cython.Compiler.Options Cython.Compiler.Options.annotate = True @@ -23,7 +27,8 @@ if 'DEBUG' in os.environ: setup(version='1.7', packages=find_packages(include=['minijson', 'minijson.*']), ext_modules=build([Multibuild('minijson', find_pyx('minijson'), - dont_snakehouse=dont_snakehouse), ], + dont_snakehouse=dont_snakehouse, + **multi_kwargs), ], compiler_directives=directives, **build_kwargs), python_requires='!=2.7.*,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,!=3.7.*', )