diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml index 34d0e06..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 @@ -24,16 +24,6 @@ jobs: uses: actions/setup-python@v1 with: python-version: ${{ matrix.python-version }} - - name: Install dependencies + - name: Install and run the checks run: | - python -m pip install --upgrade pip - pip install -r requirements/test.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/.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__ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..46e06c6 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +VENV_DIR = venv +FLAKE8_COMMAND = "flake8 src/ddt.py test" + +local_all: venv_test venv_flake8 venv_isort + +all: test flake8 + +install: + python setup.py install + pip install -Ur requirements.txt + +venv: venv/bin/activate + +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: install + sh -c pytest + +.PHONY: venv_test +venv_test: venv + . venv/bin/activate; sh -c pytest + +.PHONY: flake8 +flake8: install + sh -c $(FLAKE8_COMMAND) + +.PHONY: venv_flake8 +venv_flake8: venv + . venv/bin/activate; sh -c $(FLAKE8_COMMAND) + +.PHONY: venv_isort +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/docs/conf.py b/docs/conf.py index 7ddd598..747647b 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' @@ -56,7 +57,8 @@ # |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__ # The full version, including alpha/beta/rc tags. diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..796e573 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,5 @@ +[pytest] +minversion = 4.6 +addopts = -ra --cov=ddt --cov-report html +testpaths = + test \ No newline at end of file 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.txt b/requirements.txt new file mode 100644 index 0000000..b8c5150 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,16 @@ +codecov +coverage +enum34; python_version < '3' +flake8 +isort +mock; python_version < '3.3' +pytest +pytest-cov +PyYAML +setuptools +six>=1.4.0 +Sphinx +sphinxcontrib-programoutput +twine +wheel +flake8-isort==4.0.0 \ 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/requirements/test.txt b/requirements/test.txt deleted file mode 100644 index b07910e..0000000 --- a/requirements/test.txt +++ /dev/null @@ -1,8 +0,0 @@ -codecov -coverage -flake8 -pytest -pytest-cov -six>=1.4.0 -PyYAML -mock; python_version < '3.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 diff --git a/setup.py b/setup.py index 1ca86ff..3d6ac94 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,9 @@ #!/usr/bin/env python # # coding: utf-8 -from setuptools import setup -from ddt import __version__ +from setuptools import setup, find_packages + +from src.ddt import __version__ setup( name='ddt', @@ -12,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 diff --git a/test/test_example.py b/test/test_example.py index 1d27043..7875741 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 f9609c6..544a9c7 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