From 878f4db5a1e7816c40933bbd325b0f6fdec0b75b Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Fri, 6 Mar 2020 20:11:14 -0800 Subject: [PATCH 01/11] Semi-working testing via Makefile --- Makefile | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ff33cf2 --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +VENV_DIR = venv + +venv: + $(shell virtualenv $(VENV_DIR)) + +test-env: | venv + ( \ + source $(VENV_DIR)/bin/activate; \ + pip install -r requirements/test.txt; \ + ) + +test: test-env + ( \ + source $(VENV_DIR)/bin/activate; \ + nosetests --with-coverage --cover-html --cover-package=ddt; \ + ) + +clean: + rm -rf $(VENV_DIR) .noseids nosetests.xml .coverage From cd149249ed9ebc91992b239a08d95f2f033305d0 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Sun, 26 Jul 2020 17:39:36 -0700 Subject: [PATCH 02/11] Fix isort issues --- docs/conf.py | 4 +++- requirements/test.txt | 1 + setup.py | 1 + test/test_example.py | 4 ++-- test/test_functional.py | 7 ++++--- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 7ddd598..ab77821 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -11,7 +11,8 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # Specific for readthedocs.org on_rtd = os.environ.get('READTHEDOCS', None) == 'True' @@ -57,6 +58,7 @@ # built documents. from ddt import __version__ + # The short X.Y version. version = __version__ # The full version, including alpha/beta/rc tags. diff --git a/requirements/test.txt b/requirements/test.txt index b07910e..6004fcd 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -3,6 +3,7 @@ coverage flake8 pytest pytest-cov +isort six>=1.4.0 PyYAML mock; python_version < '3.3' diff --git a/setup.py b/setup.py index 1ca86ff..5a12629 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ # # coding: utf-8 from setuptools import setup + from ddt import __version__ setup( diff --git a/test/test_example.py b/test/test_example.py index db2cf17..761a1fc 100644 --- a/test/test_example.py +++ b/test/test_example.py @@ -1,7 +1,7 @@ import unittest +from test.mycode import has_three_elements, is_a_greeting, larger_than_two -from ddt import ddt, data, file_data, unpack -from test.mycode import larger_than_two, has_three_elements, is_a_greeting +from ddt import data, ddt, file_data, unpack try: import yaml diff --git a/test/test_functional.py b/test/test_functional.py index 45c1cae..69e6c54 100644 --- a/test/test_functional.py +++ b/test/test_functional.py @@ -1,6 +1,7 @@ -import os import json +import os from sys import modules + import pytest import six @@ -9,10 +10,10 @@ except ImportError: import mock -from ddt import ddt, data, file_data, TestNameFormat - from test.mycode import has_three_elements +from ddt import TestNameFormat, data, ddt, file_data + class CustomClass: pass From 2a73cddfc3aa0e1831732aae1f02a7221b46f657 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Sun, 26 Jul 2020 18:29:03 -0700 Subject: [PATCH 03/11] Semi-working makefile --- .github/workflows/pythonpackage.yml | 10 +---- Makefile | 51 +++++++++++++++++------ build.sh | 4 -- release.sh | 2 - requirements/test.txt => requirements.txt | 12 ++++-- requirements/build.txt | 4 -- requirements/release.txt | 5 --- rtdocs.sh | 1 - 8 files changed, 49 insertions(+), 40 deletions(-) delete mode 100755 build.sh delete mode 100755 release.sh rename requirements/test.txt => requirements.txt (52%) delete mode 100644 requirements/build.txt delete mode 100644 requirements/release.txt delete mode 100755 rtdocs.sh diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 34d0e06..89a2a75 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -27,13 +27,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install -r requirements/test.txt + pip install -r requirements.txt - name: Lint with flake8 run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest + make all diff --git a/Makefile b/Makefile index ff33cf2..cb46660 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,44 @@ VENV_DIR = venv +PYTEST_COMMAND = "pytest --cov=ddt --cov-report html" +FLAKE8_COMMAND = "flake8 ddt.py test" +ISORT_COMMAND = "isort --check-only --diff --skip-glob=.tox ." -venv: - $(shell virtualenv $(VENV_DIR)) +local_all: venv_test venv_flake8 venv_isort -test-env: | venv - ( \ - source $(VENV_DIR)/bin/activate; \ - pip install -r requirements/test.txt; \ - ) +all: test flake8 isort -test: test-env - ( \ - source $(VENV_DIR)/bin/activate; \ - nosetests --with-coverage --cover-html --cover-package=ddt; \ - ) +venv: venv/bin/activate -clean: +venv/bin/activate: requirements.txt + test -d venv || virtualenv venv + . venv/bin/activate; pip install -Ur requirements.txt + touch venv/bin/activate + +.PHONY: test +test: + sh -c $(PYTEST_COMMAND) + +.PHONY: venv_test +venv_test: venv + . venv/bin/activate; sh -c $(PYTEST_COMMAND) + +.PHONY: flake8 +flake8: + sh -c $(FLAKE8_COMMAND) + +venv_flake8: venv + . venv/bin/activate; sh -c $(FLAKE8_COMMAND) + +.PHONY: isort +isort: + sh -c $(ISORT_COMMAND) + +venv_isort: venv + . venv/bin/activate; sh -c $(ISORT_COMMAND) + +clean-pyc: + find . -name '*.pyc' -exec rm -f {} + + find . -name '*.pyo' -exec rm -f {} + + +clean: clean-pyc rm -rf $(VENV_DIR) .noseids nosetests.xml .coverage diff --git a/build.sh b/build.sh deleted file mode 100755 index 792485a..0000000 --- a/build.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -pytest --cov=ddt --cov-report html -flake8 ddt.py test || echo "Flake8 errors" -(cd docs; make html) diff --git a/release.sh b/release.sh deleted file mode 100755 index 1011742..0000000 --- a/release.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -python setup.py sdist bdist_wheel upload diff --git a/requirements/test.txt b/requirements.txt similarity index 52% rename from requirements/test.txt rename to requirements.txt index 6004fcd..f16d862 100644 --- a/requirements/test.txt +++ b/requirements.txt @@ -1,9 +1,15 @@ codecov coverage +enum34; python_version < '3' flake8 +isort +mock; python_version < '3.3' pytest pytest-cov -isort -six>=1.4.0 PyYAML -mock; python_version < '3.3' +setuptools +six>=1.4.0 +Sphinx +sphinxcontrib-programoutput +twine +wheel \ No newline at end of file diff --git a/requirements/build.txt b/requirements/build.txt deleted file mode 100644 index c187367..0000000 --- a/requirements/build.txt +++ /dev/null @@ -1,4 +0,0 @@ --r test.txt -Sphinx -sphinxcontrib-programoutput -enum34; python_version < '3' diff --git a/requirements/release.txt b/requirements/release.txt deleted file mode 100644 index cec2523..0000000 --- a/requirements/release.txt +++ /dev/null @@ -1,5 +0,0 @@ -wheel -setuptools -twine -pytest -enum34; python_version < '3' diff --git a/rtdocs.sh b/rtdocs.sh deleted file mode 100755 index e8f8a3b..0000000 --- a/rtdocs.sh +++ /dev/null @@ -1 +0,0 @@ -curl --data '' http://readthedocs.org/build/ddt From cdb01f02fce4efcbaa26a506e48976424554cd15 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Sun, 26 Jul 2020 18:40:28 -0700 Subject: [PATCH 04/11] Implemented deps install in Makefile --- .github/workflows/pythonpackage.yml | 6 +----- Makefile | 11 ++++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 89a2a75..342ef2e 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -24,10 +24,6 @@ jobs: uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install -r requirements.txt - - name: Lint with flake8 + - name: Install and run the checks run: | make all diff --git a/Makefile b/Makefile index cb46660..36ed024 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,9 @@ local_all: venv_test venv_flake8 venv_isort all: test flake8 isort +install: + pip install -Ur requirements.txt + venv: venv/bin/activate venv/bin/activate: requirements.txt @@ -15,7 +18,7 @@ venv/bin/activate: requirements.txt touch venv/bin/activate .PHONY: test -test: +test: install sh -c $(PYTEST_COMMAND) .PHONY: venv_test @@ -23,16 +26,18 @@ venv_test: venv . venv/bin/activate; sh -c $(PYTEST_COMMAND) .PHONY: flake8 -flake8: +flake8: install sh -c $(FLAKE8_COMMAND) +.PHONY: venv_flake8 venv_flake8: venv . venv/bin/activate; sh -c $(FLAKE8_COMMAND) .PHONY: isort -isort: +isort: install sh -c $(ISORT_COMMAND) +.PHONY: venv_isort venv_isort: venv . venv/bin/activate; sh -c $(ISORT_COMMAND) From ef61c747b208e26278a83ffef66d6dce27ee26c4 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Sun, 26 Jul 2020 18:45:26 -0700 Subject: [PATCH 05/11] Update release action --- .github/workflows/pythonpublish.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml index 0f39dba..daff706 100644 --- a/.github/workflows/pythonpublish.yml +++ b/.github/workflows/pythonpublish.yml @@ -18,10 +18,9 @@ jobs: uses: actions/setup-python@v1 with: python-version: '3.x' - - name: Install dependencies + - name: Install and run the checks run: | - python -m pip install --upgrade pip - pip install -r requirements/release.txt + make all - name: Build and publish env: TWINE_USERNAME: __token__ From 891f7c58c8d5a20e1802ec2ba4468c3e91361ebb Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Tue, 27 Oct 2020 22:43:21 -0700 Subject: [PATCH 06/11] Add pytest config --- Makefile | 5 ++--- pytest.ini | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 pytest.ini diff --git a/Makefile b/Makefile index 36ed024..2787813 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ VENV_DIR = venv -PYTEST_COMMAND = "pytest --cov=ddt --cov-report html" FLAKE8_COMMAND = "flake8 ddt.py test" ISORT_COMMAND = "isort --check-only --diff --skip-glob=.tox ." @@ -19,11 +18,11 @@ venv/bin/activate: requirements.txt .PHONY: test test: install - sh -c $(PYTEST_COMMAND) + sh -c pytest .PHONY: venv_test venv_test: venv - . venv/bin/activate; sh -c $(PYTEST_COMMAND) + . venv/bin/activate; sh -c pytest .PHONY: flake8 flake8: install diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..35b6d3b --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +minversion = 6.0 +addopts = -ra --cov=ddt --cov-report html +testpaths = + test \ No newline at end of file From 62a9a041c97347c24cfad56263680b5c6c209f61 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Tue, 27 Oct 2020 22:53:34 -0700 Subject: [PATCH 07/11] Allow for earlier pytest --- pytest.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytest.ini b/pytest.ini index 35b6d3b..796e573 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,5 +1,5 @@ [pytest] -minversion = 6.0 +minversion = 4.6 addopts = -ra --cov=ddt --cov-report html testpaths = test \ No newline at end of file From 2f08a4e89e23cc749a8888cf27c15a0e2af2f9da Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Fri, 27 Aug 2021 09:30:43 -0700 Subject: [PATCH 08/11] Add flake8 isort --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index f16d862..b8c5150 100644 --- a/requirements.txt +++ b/requirements.txt @@ -12,4 +12,5 @@ six>=1.4.0 Sphinx sphinxcontrib-programoutput twine -wheel \ No newline at end of file +wheel +flake8-isort==4.0.0 \ No newline at end of file From 8f058e5263c62aa26fa2a659f1a4b824cf9759d7 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Fri, 27 Aug 2021 10:19:13 -0700 Subject: [PATCH 09/11] Switch to src directory for testing --- Makefile | 8 ++------ docs/conf.py | 2 +- setup.py | 6 ++++-- ddt.py => src/ddt.py | 0 4 files changed, 7 insertions(+), 9 deletions(-) rename ddt.py => src/ddt.py (100%) diff --git a/Makefile b/Makefile index 2787813..2a7023c 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,12 @@ VENV_DIR = venv FLAKE8_COMMAND = "flake8 ddt.py test" -ISORT_COMMAND = "isort --check-only --diff --skip-glob=.tox ." local_all: venv_test venv_flake8 venv_isort -all: test flake8 isort +all: test flake8 install: + python setup.py install pip install -Ur requirements.txt venv: venv/bin/activate @@ -32,10 +32,6 @@ flake8: install venv_flake8: venv . venv/bin/activate; sh -c $(FLAKE8_COMMAND) -.PHONY: isort -isort: install - sh -c $(ISORT_COMMAND) - .PHONY: venv_isort venv_isort: venv . venv/bin/activate; sh -c $(ISORT_COMMAND) diff --git a/docs/conf.py b/docs/conf.py index ab77821..747647b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -57,7 +57,7 @@ # |version| and |release|, also used in various other places throughout the # built documents. -from ddt import __version__ +from src.ddt import __version__ # The short X.Y version. version = __version__ diff --git a/setup.py b/setup.py index 5a12629..3d6ac94 100644 --- a/setup.py +++ b/setup.py @@ -1,9 +1,9 @@ #!/usr/bin/env python # # coding: utf-8 -from setuptools import setup +from setuptools import setup, find_packages -from ddt import __version__ +from src.ddt import __version__ setup( name='ddt', @@ -13,6 +13,8 @@ author='Carles Barrobés', author_email='carles@barrobes.com', url='https://github.com/datadriventests/ddt', + packages=find_packages(where="src"), + package_dir={"": "src"}, py_modules=['ddt'], classifiers=[ 'Development Status :: 4 - Beta', diff --git a/ddt.py b/src/ddt.py similarity index 100% rename from ddt.py rename to src/ddt.py From a2c4e5eac5b2a99c0396022f1e4373c42b577d53 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Fri, 27 Aug 2021 10:37:57 -0700 Subject: [PATCH 10/11] Minor Flake8 fix --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2a7023c..46e06c6 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ VENV_DIR = venv -FLAKE8_COMMAND = "flake8 ddt.py test" +FLAKE8_COMMAND = "flake8 src/ddt.py test" local_all: venv_test venv_flake8 venv_isort From caea30d5ab8ed2e1e78a613bf9f7d494a78a4849 Mon Sep 17 00:00:00 2001 From: Vsevolod Glumov Date: Mon, 25 Oct 2021 21:56:16 -0700 Subject: [PATCH 11/11] Add support for 3.9 and 3.10 --- .github/workflows/pythonpackage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 342ef2e..a62fbde 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage.yml @@ -16,7 +16,7 @@ jobs: timeout-minutes: 5 strategy: matrix: - python-version: [2.7, 3.5, 3.6, 3.7, 3.8] + python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9, 3.10] steps: - uses: actions/checkout@v2