From 10e20dd372a7f54a045a908e1f4e459b4a0bbbb9 Mon Sep 17 00:00:00 2001 From: shunyi Date: Sun, 14 Oct 2018 14:07:29 +0800 Subject: [PATCH 1/3] [#8] Local test for multiple python version with `tox` and `pyenv` --- test-requirements.txt | 2 ++ tox.ini | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 tox.ini diff --git a/test-requirements.txt b/test-requirements.txt index a5535d3..0c3d7c8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,3 +4,5 @@ coveralls==1.3.0 pytest==3.1.3 pytest-cov==2.5.1 flake8==3.3.0 +flit==1.1.0 +tox-pyenv==1.1.0 diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..cf2075b --- /dev/null +++ b/tox.ini @@ -0,0 +1,8 @@ +[tox] +envlist = py30,py31,py32,py33,py34,py35,py36,py37 +skipsdist = True + +[testenv] +deps=-rtest-requirements.txt +commands = flit install + python -m pytest -vv --cov hor2vec/ --cov-report html --cov-report term From 052dd415202f94afbf18f480f9a0b97ef692b5b5 Mon Sep 17 00:00:00 2001 From: shunyi Date: Sun, 14 Oct 2018 14:08:02 +0800 Subject: [PATCH 2/3] [#8] Modify circleci/config.yml for multiple python versions --- .circleci/config.yml | 65 ++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 59e40f3..17a1f93 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,56 +3,49 @@ # Check https://circleci.com/docs/2.0/language-python/ for more details # version: 2 +workflows: + version: 2 + test: + jobs: + - test-3.7 + - test-3.6 + - test-3.5 + - test-3.4 + - test-2.7 jobs: - build: + test-3.7: &test-template docker: - # specify the version you desire here - # use `-browsers` prefix for selenium tests, e.g. `3.6.1-browsers` - - image: circleci/python:3.6.1 - - # Specify service dependencies here if necessary - # CircleCI maintains a library of pre-built images - # documented at https://circleci.com/docs/2.0/circleci-images/ - # - image: circleci/postgres:9.4 - + # Available CircleCI Python images: https://hub.docker.com/r/circleci/python/tags/ + - image: circleci/python:3.7 working_directory: ~/repo - steps: - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "test-requirements.txt" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - run: name: install dependencies command: | - python3 -m venv venv - . venv/bin/activate - pip install -r test-requirements.txt - - - save_cache: - paths: - - ./venv - key: v1-dependencies-{{ checksum "test-requirements.txt" }} - - # run tests! - # this example uses Django's built-in test-runner - # other common Python testing frameworks include pytest and nose - # https://pytest.org - # https://nose.readthedocs.io + sudo pip install -r test-requirements.txt - run: name: run tests command: | - . venv/bin/activate make test coveralls - - store_test_results: path: htmlcov - - store_artifacts: path: htmlcov + test-3.6: + <<: *test-template + docker: + - image: circleci/python:3.6 + test-3.5: + <<: *test-template + docker: + - image: circleci/python:3.5 + test-3.4: + <<: *test-template + docker: + - image: circleci/python:3.4 + test-2.7: + <<: *test-template + docker: + - image: circleci/python:2.7 From 3387a55df36c7ad65b6c7e76dccac6893b34d539 Mon Sep 17 00:00:00 2001 From: shunyi Date: Sun, 14 Oct 2018 14:31:02 +0800 Subject: [PATCH 3/3] [#8] Only test for Python 3 - tox: py30,py31,py32,py33,py34,py35,py36,py37 - circleci: py34,py35,py36,py37 --- .circleci/config.yml | 5 ----- test-requirements.txt | 1 - tox.ini | 3 +-- 3 files changed, 1 insertion(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 17a1f93..6a0d5fe 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,6 @@ workflows: - test-3.6 - test-3.5 - test-3.4 - - test-2.7 jobs: test-3.7: &test-template docker: @@ -45,7 +44,3 @@ jobs: <<: *test-template docker: - image: circleci/python:3.4 - test-2.7: - <<: *test-template - docker: - - image: circleci/python:2.7 diff --git a/test-requirements.txt b/test-requirements.txt index 0c3d7c8..64b8186 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,5 +4,4 @@ coveralls==1.3.0 pytest==3.1.3 pytest-cov==2.5.1 flake8==3.3.0 -flit==1.1.0 tox-pyenv==1.1.0 diff --git a/tox.ini b/tox.ini index cf2075b..64e20dc 100644 --- a/tox.ini +++ b/tox.ini @@ -4,5 +4,4 @@ skipsdist = True [testenv] deps=-rtest-requirements.txt -commands = flit install - python -m pytest -vv --cov hor2vec/ --cov-report html --cov-report term +commands = python -m pytest -vv --cov hor2vec/ --cov-report html --cov-report term