From e8eca47f0b2121487a33b63401a4ddb7e6d43fd9 Mon Sep 17 00:00:00 2001 From: Marco Clemencic <marco.clemencic@cern.ch> Date: Tue, 2 Oct 2018 17:22:57 +0200 Subject: [PATCH] Hack for Python3 tests --- .coveragerc | 1 + .gitlab-ci.yml | 6 +++--- nose2.cfg | 1 + setup.py | 15 +++++++++++++++ 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.coveragerc b/.coveragerc index 29a7797..385fca7 100644 --- a/.coveragerc +++ b/.coveragerc @@ -3,6 +3,7 @@ cover_pylib = False omit = /usr/* */.local/* */tests/* + .eggs/* setup.py [report] diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 174f665..e5d828a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -69,7 +69,7 @@ python3.5: script: - python --version - python setup.py test - - mkdir -p cover_report && mv -f build/lib/cover cover_report/$CI_JOB_NAME + - mkdir -p cover_report && mv -f cover cover_report/$CI_JOB_NAME - python setup.py install && lb-describe-platform --flags artifacts: paths: @@ -82,7 +82,7 @@ python3.6: script: - python --version - python setup.py test - - mkdir -p cover_report && mv -f build/lib/cover cover_report/$CI_JOB_NAME + - mkdir -p cover_report && mv -f cover cover_report/$CI_JOB_NAME - python setup.py install && lb-describe-platform --flags - python setup.py sdist --dist-dir public/${CI_PROJECT_NAME,,} - python setup.py bdist_wheel --dist-dir public/${CI_PROJECT_NAME,,} @@ -98,7 +98,7 @@ python3.7: script: - python --version - python setup.py test - - mkdir -p cover_report && mv -f build/lib/cover cover_report/$CI_JOB_NAME + - mkdir -p cover_report && mv -f cover cover_report/$CI_JOB_NAME - python setup.py install && lb-describe-platform --flags - python setup.py sdist --dist-dir public/${CI_PROJECT_NAME,,} - python setup.py bdist_wheel --dist-dir public/${CI_PROJECT_NAME,,} diff --git a/nose2.cfg b/nose2.cfg index 5e506ab..ceec918 100644 --- a/nose2.cfg +++ b/nose2.cfg @@ -1,4 +1,5 @@ [unittest] +start-dir = . plugins = nose2.plugins.doctests [coverage] diff --git a/setup.py b/setup.py index 4f0e975..f637efc 100644 --- a/setup.py +++ b/setup.py @@ -18,6 +18,21 @@ here = path.abspath(path.dirname(__file__)) with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() +if version_info >= (3, 0): + import shutil + shutil.copy(path.join(here, 'nose2.cfg'), path.join(here, 'nose2.cfg~')) + with open(path.join(here, 'nose2.cfg'), 'w', encoding='utf-8') as f: + f.writelines(l.replace('start-dir = .', 'start-dir = ./build/lib') + for l in open(path.join(here, 'nose2.cfg~'), + encoding='utf-8')) + shutil.copy(path.join(here, '.coveragerc'), path.join(here, '.coveragerc~')) + with open(path.join(here, '.coveragerc'), 'w', encoding='utf-8') as f: + f.writelines(l.replace('setup.py', 'setup.py\n LbPlatformUtils/*') + for l in open(path.join(here, '.coveragerc~'), + encoding='utf-8')) + + + # Arguments marked as "Required" below must be included for upload to PyPI. # Fields marked as "Optional" may be commented out. -- GitLab