From 58e9967042bf3cff6eef0669874b7fc03c4f5113 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 11:05:16 -0400 Subject: [PATCH 01/17] upgrade cffi to >=1.7.0 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index a45d2e3..21823cc 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ raise requirements = [ - "cffi>=1.6.0", + "cffi>=1.7.0", "six" ] From d9ffb8a8e0e95ae42a0b5d7acc85510323710240 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 11:06:22 -0400 Subject: [PATCH 02/17] replace nose with py.test (more reliable, cleaner output and faster) --- .ci/appveyor/test.cmd | 3 +-- .gitignore | 5 +++-- dev_requirements-2.6.txt | 3 ++- dev_requirements.txt | 3 ++- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.ci/appveyor/test.cmd b/.ci/appveyor/test.cmd index 697a91f..5618ac9 100644 --- a/.ci/appveyor/test.cmd +++ b/.ci/appveyor/test.cmd @@ -1,7 +1,6 @@ SET REQUIREMENTS=dev_requirements.txt --upgrade IF "%PYTHON_VERSION%" == "2.6.x" SET REQUIREMENTS=dev_requirements-2.6.txt %WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r %REQUIREMENTS% --quiet || EXIT 1 - -%WITH_COMPILER% %PYTHON%\Scripts\nosetests.exe --with-coverage --cover-package pywincffi -v tests || EXIT 1 +%WITH_COMPILER% %PYTHON%\Scripts\py.test.exe --strict --verbose --cov pywincffi || EXIT 1 %PYTHON%\Scripts\coverage.exe xml || EXIT 1 %PYTHON%\Scripts\codecov.exe --required || EXIT 1 diff --git a/.gitignore b/.gitignore index 8993944..52342f5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,8 @@ /*.egg-info/ /docs/build/ /.tox/ -.coverage +/.coverage.* +/.coverage /docs/source/modules/ /.vagrant /.provision @@ -14,4 +15,4 @@ /pywincffi.ini /Release* *_pywincffi.c -/.idea/ \ No newline at end of file +/.idea/ diff --git a/dev_requirements-2.6.txt b/dev_requirements-2.6.txt index 06b3772..87ca003 100644 --- a/dev_requirements-2.6.txt +++ b/dev_requirements-2.6.txt @@ -1,7 +1,8 @@ # NOTE: This requirements file is for Python 2.6 only. Packages are slowly # dropping support for 2.6, this file allows the project to lock down # these requirements -nose +pytest +pytest-cov unittest2 logilab-common>=0.53.0 pylint<1.4 diff --git a/dev_requirements.txt b/dev_requirements.txt index f3bc26c..02c9bea 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,4 +1,5 @@ -nose +pytest +pytest-cov unittest2 pylint==1.5.2 astroid==1.4.1 From ef308823f21f14eeb0c938896b2f6b3f3d8c6c01 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 11:09:33 -0400 Subject: [PATCH 03/17] add python 3.6 to matrix --- appveyor.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index f6455db..9bf9904 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,6 +45,14 @@ environment: PYTHON_VERSION: "3.5.x" PYTHON_ARCH: "64" + - PYTHON: "C:\\Python36" + PYTHON_VERSION: "3.6.x" + PYTHON_ARCH: "32" + + - PYTHON: "C:\\Python36-x64" + PYTHON_VERSION: "3.6.x" + PYTHON_ARCH: "64" + build: false # Not a C# project, build stuff at the test step instead. clone_folder: C:\\project From a4ea830c483f1fc3e10ee9f0285119c8fde32bd7 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:04:05 -0400 Subject: [PATCH 04/17] remove Python 2.6 from build There are several dependencies which no longer support Python 2.6 including the wheel library. Twisted itself also no longer supports Python 2.6. Finally, official support for the version ended back in 2013 and several major operating systems do not use it as their default version. --- .ci/appveyor/test.cmd | 4 +--- README.rst | 6 ++---- appveyor.yml | 8 -------- dev_requirements-2.6.txt | 18 ------------------ docs/source/index.rst | 2 +- 5 files changed, 4 insertions(+), 34 deletions(-) delete mode 100644 dev_requirements-2.6.txt diff --git a/.ci/appveyor/test.cmd b/.ci/appveyor/test.cmd index 5618ac9..f77b937 100644 --- a/.ci/appveyor/test.cmd +++ b/.ci/appveyor/test.cmd @@ -1,6 +1,4 @@ -SET REQUIREMENTS=dev_requirements.txt --upgrade -IF "%PYTHON_VERSION%" == "2.6.x" SET REQUIREMENTS=dev_requirements-2.6.txt -%WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r %REQUIREMENTS% --quiet || EXIT 1 +%WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r dev_requirements.txt --upgrade --quiet || EXIT 1 %WITH_COMPILER% %PYTHON%\Scripts\py.test.exe --strict --verbose --cov pywincffi || EXIT 1 %PYTHON%\Scripts\coverage.exe xml || EXIT 1 %PYTHON%\Scripts\codecov.exe --required || EXIT 1 diff --git a/README.rst b/README.rst index 4286f95..3f30e49 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ The core objectives and design principles behind this project are: * It should be easier to to use Windows API functions both in terms of implementation and distribution. - * Python 2.6, 2.7 and 3.x should be supported from a single code base and + * Python 2.7 and 3.x should be supported from a single code base and not require a consumer of pywincffi to worry about how they use the library. * Type conversion, error checking and other 'C like' code should be the @@ -64,7 +64,7 @@ help: Python Version Support ---------------------- -This project supports Python 2.6 and up including Python 3.x. PRs, patches, +This project supports Python 2.7 and up including Python 3.x. PRs, patches, tests etc that don't include support for both 2.x and 3.x will not be merged. The aim is also the support both major versions of Python within the same code base rather than rely on tools such as 2to3, six or other @@ -87,8 +87,6 @@ It's generated directly from this library using sphinx:: The build process also builds the documentation to ensure there are not any obvious problems (including broken links). -Note, if you're running Python 2.6 use dev_requirements-2.6.txt instead. - Function Documentation ~~~~~~~~~~~~~~~~~~~~~~ diff --git a/appveyor.yml b/appveyor.yml index 9bf9904..f32ecef 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,14 +5,6 @@ environment: WITH_COMPILER: "cmd /E:ON /V:ON /C C:\\project\\.ci\\appveyor\\run_with_compiler.cmd" matrix: - - PYTHON: "C:\\Python26" - PYTHON_VERSION: "2.6.x" - PYTHON_ARCH: "32" - - - PYTHON: "C:\\Python26-x64" - PYTHON_VERSION: "2.6.x" - PYTHON_ARCH: "64" - - PYTHON: "C:\\Python27" PYTHON_VERSION: "2.7.x" PYTHON_ARCH: "32" diff --git a/dev_requirements-2.6.txt b/dev_requirements-2.6.txt deleted file mode 100644 index 87ca003..0000000 --- a/dev_requirements-2.6.txt +++ /dev/null @@ -1,18 +0,0 @@ -# NOTE: This requirements file is for Python 2.6 only. Packages are slowly -# dropping support for 2.6, this file allows the project to lock down -# these requirements -pytest -pytest-cov -unittest2 -logilab-common>=0.53.0 -pylint<1.4 -astroid<=1.3.2 -pep8 -mock -sphinx -wheel -setuptools -coverage -requests -codecov -PyGithub diff --git a/docs/source/index.rst b/docs/source/index.rst index c28b164..95a28e7 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -11,7 +11,7 @@ The core objectives and design principles behind this project are: * It should be easier to to use Windows API functions both in terms of implementation and distribution. - * Python 2.6, 2.7 and 3.x should be supported from a single code base and + * Python 2.7 and 3.x should be supported from a single code base and not require a consumer of pywincffi to worry about how they use the library. * Type conversion, error checking and other 'C like' code should be the From 5bfd3e69f333338a20bcb0e78e04159c58d648cf Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:19:43 -0400 Subject: [PATCH 05/17] ignore coverage.xml --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 52342f5..3a6d169 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,9 @@ /*.egg-info/ /docs/build/ /.tox/ -/.coverage.* /.coverage +/.coverage.* +/coverage.* /docs/source/modules/ /.vagrant /.provision From 798c8281a94647ffafdb48d69a062ec1c8a2032f Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:20:28 -0400 Subject: [PATCH 06/17] debugging appveyor build --- .ci/appveyor/test.cmd | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.ci/appveyor/test.cmd b/.ci/appveyor/test.cmd index f77b937..f844f8a 100644 --- a/.ci/appveyor/test.cmd +++ b/.ci/appveyor/test.cmd @@ -1,4 +1,5 @@ %WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r dev_requirements.txt --upgrade --quiet || EXIT 1 -%WITH_COMPILER% %PYTHON%\Scripts\py.test.exe --strict --verbose --cov pywincffi || EXIT 1 +%WITH_COMPILER% %PYTHON%\Scripts\py.test.exe --strict --verbose --cov pywincffi --cov-report=xml || EXIT 1 %PYTHON%\Scripts\coverage.exe xml || EXIT 1 -%PYTHON%\Scripts\codecov.exe --required || EXIT 1 +dir +%PYTHON%\Scripts\codecov.exe -X gcov --required || EXIT 1 From 298c0db270517ae2963303c32c99a08849d7a4a0 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:27:27 -0400 Subject: [PATCH 07/17] upload code coverage directly from file --- .ci/appveyor/test.cmd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.ci/appveyor/test.cmd b/.ci/appveyor/test.cmd index f844f8a..34d1a6a 100644 --- a/.ci/appveyor/test.cmd +++ b/.ci/appveyor/test.cmd @@ -1,5 +1,3 @@ %WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r dev_requirements.txt --upgrade --quiet || EXIT 1 %WITH_COMPILER% %PYTHON%\Scripts\py.test.exe --strict --verbose --cov pywincffi --cov-report=xml || EXIT 1 -%PYTHON%\Scripts\coverage.exe xml || EXIT 1 -dir -%PYTHON%\Scripts\codecov.exe -X gcov --required || EXIT 1 +%PYTHON%\Scripts\codecov.exe -f coverage.xml --required || EXIT 1 From e3072adb011703bee0be8bcb6f353dca4212f784 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:40:51 -0400 Subject: [PATCH 08/17] updating changelog --- docs/source/changelog.rst | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index fae8b7e..3279a8f 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -8,6 +8,22 @@ versions are shown first. Versions -------- +0.5.0 +~~~~~ + +Notable enhancements and changes are: + + * **Python 2.6 support has been dropped**. Many projects have already moved + on from Python 2.6 including Twisted which this project was initially + intended to support. Additionally many libraries or tools that pywincffi + no longer have direct support for Python 2.6 or simply break in later + versions. This leads to having to maintain and support older libraries + in ths build which is going to become increasing difficult. Pull requests + to support Python 2.6 will be evaluated on a case-by-case basis. + * Various improvements to the tests and build including replacement of + nosetests with pytest, transition from pep8 to pycodestyle and upgrading + tools and libraries to more modern versions. + 0.4.0 ~~~~~ From ac2f94849dd9ca599c3177c2de35bfe87a57b79e Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:41:11 -0400 Subject: [PATCH 09/17] lint fixes --- pywincffi/dev/release.py | 1 + tests/test_dev/test_release.py | 1 + tools/release.py | 1 + 3 files changed, 3 insertions(+) diff --git a/pywincffi/dev/release.py b/pywincffi/dev/release.py index b56a9a1..2725107 100644 --- a/pywincffi/dev/release.py +++ b/pywincffi/dev/release.py @@ -195,6 +195,7 @@ def download(cls, url, path=None, chunk_size=1024): return path + Issue = namedtuple( "Issue", ("issue", "closed", "labels", "type", "number", "url", "title")) diff --git a/tests/test_dev/test_release.py b/tests/test_dev/test_release.py index e0145fd..1472afb 100644 --- a/tests/test_dev/test_release.py +++ b/tests/test_dev/test_release.py @@ -330,6 +330,7 @@ def test_commit(self): # pylint: disable=no-member api.repo.get_branch.assert_called_with(api.branch) + FakeLabel = namedtuple("FakeLabel", ("name", )) diff --git a/tools/release.py b/tools/release.py index 29d0d57..632974c 100755 --- a/tools/release.py +++ b/tools/release.py @@ -166,5 +166,6 @@ def main(): if not docs_built(version): logger.error("Documentation not built for %s", version) + if __name__ == "__main__": main() From 6da4b24cededa719d6260b18bf15e03987a20d6b Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:41:29 -0400 Subject: [PATCH 10/17] drop 2.6 from lint steps --- .ci/appveyor/lint.cmd | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.ci/appveyor/lint.cmd b/.ci/appveyor/lint.cmd index c095410..007eab4 100644 --- a/.ci/appveyor/lint.cmd +++ b/.ci/appveyor/lint.cmd @@ -1,9 +1,7 @@ -%PYTHON%\Scripts\pep8.exe C:\project\pywincffi C:\project\tests || EXIT 1 +%PYTHON%\Scripts\pycodestyle.exe C:\project\pywincffi C:\project\tests || EXIT 1 SET DISABLED_PYWINCFFI_CHECKS="" SET DISABLED_TEST_CHECKS=missing-docstring,invalid-name,too-many-arguments,protected-access,no-self-use,unused-argument,too-few-public-methods -IF "%PYTHON_VERSION%" == "2.6.x" SET DISABLED_PYWINCFFI_CHECKS=bad-option-value,unpacking-non-sequence,maybe-no-member,star-args -IF "%PYTHON_VERSION%" == "2.6.x" SET DISABLED_TEST_CHECKS=missing-docstring,invalid-name,too-many-arguments,protected-access,no-self-use,unused-argument,maybe-no-member,too-few-public-methods,too-many-public-methods,unpacking-non-sequence,bad-option-value,star-args,no-member,import-error %PYTHON%\Scripts\pylint.exe C:\project\pywincffi --reports no --disable %DISABLED_PYWINCFFI_CHECKS% || EXIT 1 %PYTHON%\Scripts\pylint.exe C:\project\tests --reports no --disable %DISABLED_TEST_CHECKS% || EXIT 1 From 29092809acdd4da206549bb99edb21f624c554d0 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:42:05 -0400 Subject: [PATCH 11/17] updating classifiers, reverting cffi version bump --- setup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index 21823cc..0573497 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ raise requirements = [ - "cffi>=1.7.0", + "cffi>=1.6.0", "six" ] @@ -84,6 +84,7 @@ def run(self): filename = join(root, filename) self.upload_file(command, pyversion, filename) + setup_keywords = dict( name="pywincffi", version=".".join(map(str, __version__)), @@ -101,15 +102,14 @@ def run(self): long_description=long_description, setup_requires=requirements, install_requires=requirements, - test_suite="nose.collector", classifiers=[ - "Development Status :: 3 - Alpha", + "Development Status :: 5 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Environment :: Win32 (MS Windows)", "Operating System :: Microsoft :: Windows", - "Programming Language :: Python :: 2", + "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", From 2de36a086a3d62443c4577f1cf1bb74a4bbed81f Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:42:15 -0400 Subject: [PATCH 12/17] replace pep8 with codestyle --- dev_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 02c9bea..53d2b68 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -3,7 +3,7 @@ pytest-cov unittest2 pylint==1.5.2 astroid==1.4.1 -pep8 +pycodestyle mock sphinx wheel From d2e50917666230ae3c611247b6f9b0140d085e66 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:54:05 -0400 Subject: [PATCH 13/17] exclude gcov --- .ci/appveyor/test.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/appveyor/test.cmd b/.ci/appveyor/test.cmd index 34d1a6a..5cc7985 100644 --- a/.ci/appveyor/test.cmd +++ b/.ci/appveyor/test.cmd @@ -1,3 +1,3 @@ %WITH_COMPILER% %PYTHON%\Scripts\pip.exe install -r dev_requirements.txt --upgrade --quiet || EXIT 1 %WITH_COMPILER% %PYTHON%\Scripts\py.test.exe --strict --verbose --cov pywincffi --cov-report=xml || EXIT 1 -%PYTHON%\Scripts\codecov.exe -f coverage.xml --required || EXIT 1 +%PYTHON%\Scripts\codecov.exe -X gcov -f coverage.xml --required || EXIT 1 From 1086c0b68d2624cba87a79b0d7d96128c9c42a25 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:54:23 -0400 Subject: [PATCH 14/17] simplify local testing script --- README.rst | 38 +++++++------------------------------- check.bat | 28 ++++++++++++++++++++++++++++ test.bat | 52 ---------------------------------------------------- 3 files changed, 35 insertions(+), 83 deletions(-) create mode 100644 check.bat delete mode 100644 test.bat diff --git a/README.rst b/README.rst index 3f30e49..ba7ad1a 100644 --- a/README.rst +++ b/README.rst @@ -171,38 +171,14 @@ run ``test.bat``: .. code-block:: console - > test.bat - ======================================================================================== - pep8 pywincffi - ======================================================================================== - ======================================================================================== - pep8 tests - ======================================================================================== - ======================================================================================== - pylint pywincffi - ======================================================================================== - ======================================================================================== - pylint tests - ======================================================================================== - ======================================================================================== - sphinx-build -q -b html -W -E -a -d docs/build/doctrees docs/source docs/build/html - ======================================================================================== - ======================================================================================== - sphinx-build -q -b linkcheck -W -E -a -d docs/build/doctrees docs/source docs/build/html - ======================================================================================== - ======================================================================================== - setup.py bdist_wheel - ======================================================================================== - RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect - warn=(impl == 'cp')): - RuntimeWarning: Config variable 'WITH_PYMALLOC' is unset, Python ABI tag may be incorrect - warn=(impl == 'cp')): - ======================================================================================== - nosetests -sv tests - ======================================================================================== - [ omitted ] - ======================================================================================== + > check.bat +This will: + + * Check code style for both the library and tests. + * Run all unittests. + * Build the wheel file. + * Build the documentation and treat warnings as errors. Keep in mind that this will not setup the virtualenv or build environment for you. So if you can't build the library or are missing a dependency then diff --git a/check.bat b/check.bat new file mode 100644 index 0000000..dd6c61b --- /dev/null +++ b/check.bat @@ -0,0 +1,28 @@ +@ECHO ON + +:: A simple script for testing on Windows. This does almost the same thing +:: that Travis and AppVeyor do except it does not perform additional setup +:: steps such as creating a virtual environment. + +pycodestyle pywincffi +IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +pycodestyle tests +IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +pylint pywincffi --reports no +IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +pylint tests --reports no ^ + --disable missing-docstring,invalid-name,too-many-arguments ^ + --disable protected-access,no-self-use,unused-argument ^ + --disable too-few-public-methods +IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +python setup.py bdist_wheel > NUL +IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +py.test.exe --strict --verbose --cov pywincffi +IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% + +sphinx-build -q -b html -W -E -a -d docs/build/doctrees docs/source docs/build/html diff --git a/test.bat b/test.bat deleted file mode 100644 index 7b90279..0000000 --- a/test.bat +++ /dev/null @@ -1,52 +0,0 @@ -@ECHO OFF - -:: A simple script for testing on Windows. This does almost the same thing -:: that Travis and AppVeyor do. -:: NOTE: This script does not perform any kind of setup (virtualenv, build -:: tool chanin, etc) - -ECHO ======================================================================================== -ECHO pep8 pywincffi -ECHO ======================================================================================== -pep8 pywincffi -IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% - -ECHO ======================================================================================== -ECHO pep8 tests -ECHO ======================================================================================== -pep8 tests -IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% - -ECHO ======================================================================================== -ECHO pylint pywincffi -ECHO ======================================================================================== -pylint pywincffi --reports no -IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% - -ECHO ======================================================================================== -ECHO pylint tests -ECHO ======================================================================================== -pylint tests --reports no ^ - --disable missing-docstring,invalid-name,too-many-arguments ^ - --disable protected-access,no-self-use,unused-argument ^ - --disable too-few-public-methods -IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% - -ECHO ======================================================================================== -ECHO setup.py bdist_wheel -ECHO ======================================================================================== -python setup.py bdist_wheel > NUL -IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% - -ECHO ======================================================================================== -ECHO nosetests -sv tests -ECHO ======================================================================================== -nosetests -sv tests -IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% - -ECHO ======================================================================================== -ECHO sphinx-build -q -b html -W -E -a -d docs/build/doctrees docs/source docs/build/html -ECHO ======================================================================================== -sphinx-build -q -b html -W -E -a -d docs/build/doctrees docs/source docs/build/html -IF %ERRORLEVEL% neq 0 exit /b %ERRORLEVEL% -ECHO ======================================================================================== From 470d76105c5c6995ecd9e625076c083c5751ffe5 Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 12:57:49 -0400 Subject: [PATCH 15/17] fix errors in readme --- README.rst | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/README.rst b/README.rst index ba7ad1a..8fb514c 100644 --- a/README.rst +++ b/README.rst @@ -129,20 +129,6 @@ Adding new functions is covered in greater detail Testing ------- -Nosetests -~~~~~~~~~ -Tests are located in the ``tests/`` directory. The tests -themselves are run using ``nosetests`` either manually or using -the ``setup.py`` file:: - - virtualenv env - env/bin/activate - pip install -r dev_requirements.txt - pip install -e . - nosetests tests - -Note, if you're running Python 2.6 use dev_requirements-2.6.txt instead. - Continuous Integration ~~~~~~~~~~~~~~~~~~~~~~ @@ -175,10 +161,10 @@ run ``test.bat``: This will: - * Check code style for both the library and tests. - * Run all unittests. - * Build the wheel file. - * Build the documentation and treat warnings as errors. +* Check code style for both the library and tests. +* Run all unittests. +* Build the wheel file. +* Build the documentation and treat warnings as errors. Keep in mind that this will not setup the virtualenv or build environment for you. So if you can't build the library or are missing a dependency then From a6a70c7ef8741f0f80b7d18fa5f24892cd74cc7b Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 13:29:56 -0400 Subject: [PATCH 16/17] upgrade pylint --- dev_requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dev_requirements.txt b/dev_requirements.txt index 53d2b68..4da5eac 100644 --- a/dev_requirements.txt +++ b/dev_requirements.txt @@ -1,8 +1,8 @@ pytest pytest-cov unittest2 -pylint==1.5.2 -astroid==1.4.1 +pylint==1.7.4 +astroid==1.5.3 pycodestyle mock sphinx From 89bfb710ea5dc9844b88b318a019aba49b2a430e Mon Sep 17 00:00:00 2001 From: Oliver Palmer Date: Sat, 28 Oct 2017 13:34:20 -0400 Subject: [PATCH 17/17] lint fixes --- pywincffi/core/dist.py | 1 + pywincffi/dev/release.py | 3 +-- pywincffi/dev/testutil.py | 1 - pywincffi/wintypes/functions.py | 7 ++++--- tests/test_kernel32/test_file.py | 18 +++++++++--------- tests/test_kernel32/test_synchronization.py | 1 + 6 files changed, 16 insertions(+), 15 deletions(-) diff --git a/pywincffi/core/dist.py b/pywincffi/core/dist.py index ffce15e..c1cb430 100644 --- a/pywincffi/core/dist.py +++ b/pywincffi/core/dist.py @@ -200,6 +200,7 @@ def _import_path(path, module_name=MODULE_NAME): elif ExtensionFileLoader is not None: loader = ExtensionFileLoader(module_name, path) + # pylint: disable=deprecated-method return loader.load_module(module_name) elif imp is not None: # pragma: no cover diff --git a/pywincffi/dev/release.py b/pywincffi/dev/release.py index 2725107..14e5c11 100644 --- a/pywincffi/dev/release.py +++ b/pywincffi/dev/release.py @@ -381,8 +381,7 @@ def create_release( draft=True, prerelease=prerelease ) - else: - return message + return message AppVeyorArtifact = namedtuple( diff --git a/pywincffi/dev/testutil.py b/pywincffi/dev/testutil.py index 65418e2..2be24f6 100644 --- a/pywincffi/dev/testutil.py +++ b/pywincffi/dev/testutil.py @@ -156,7 +156,6 @@ def setUpClass(cls): # pylint: disable=broad-except except Exception as error: # pragma: no cover if os.name == "nt": - # pylint: disable=redefined-variable-type SharedState.ffi = error cls.HAS_INTERNET = SharedState.HAS_INTERNET diff --git a/pywincffi/wintypes/functions.py b/pywincffi/wintypes/functions.py index cf64de7..0fcab12 100644 --- a/pywincffi/wintypes/functions.py +++ b/pywincffi/wintypes/functions.py @@ -39,10 +39,11 @@ def wintype_to_cdata(wintype): ffi, _ = dist.load() if wintype is None: return ffi.NULL - elif isinstance(wintype, (SOCKET, HANDLE, WSAEVENT)): + + if isinstance(wintype, (SOCKET, HANDLE, WSAEVENT)): return wintype._cdata[0] - else: - return wintype._cdata + + return wintype._cdata def handle_from_file(file_): diff --git a/tests/test_kernel32/test_file.py b/tests/test_kernel32/test_file.py index e3e3972..a0cbbdc 100644 --- a/tests/test_kernel32/test_file.py +++ b/tests/test_kernel32/test_file.py @@ -103,8 +103,8 @@ def test_replaces_file(self): self.addCleanup(os.remove, path2) os.close(fd) - path1 = text_type(path1) # pylint: disable=redefined-variable-type - path2 = text_type(path2) # pylint: disable=redefined-variable-type + path1 = text_type(path1) + path2 = text_type(path2) MoveFileEx(path1, path2) with open(path2, "r") as file_: @@ -129,8 +129,8 @@ def test_renames_file(self): with os.fdopen(fd, "w") as file_: file_.write(file_contents) - path1 = text_type(path1) # pylint: disable=redefined-variable-type - path2 = text_type(path2) # pylint: disable=redefined-variable-type + path1 = text_type(path1) + path2 = text_type(path2) MoveFileEx(path1, path2) with open(path2, "r") as file_: @@ -142,7 +142,7 @@ def test_run_delete_after_reboot(self): fd, path = tempfile.mkstemp('-removed-on-next-reboot') os.close(fd) - path = text_type(path) # pylint: disable=redefined-variable-type + path = text_type(path) _, library = dist.load() try: @@ -171,7 +171,7 @@ def test_creates_file(self): os.close(fd) os.remove(path) - path = text_type(path) # pylint: disable=redefined-variable-type + path = text_type(path) handle = CreateFile(path, 0) self.addCleanup(os.remove, path) self.addCleanup(CloseHandle, handle) @@ -186,7 +186,7 @@ def test_default_create_disposition(self): file_.flush() os.fsync(file_.fileno()) - path = text_type(path) # pylint: disable=redefined-variable-type + path = text_type(path) handle = CreateFile(path, 0) self.addCleanup(os.remove, path) self.addCleanup(CloseHandle, handle) @@ -207,7 +207,7 @@ def raise_(*_): raise WindowsAPIError("", "", library.ERROR_ALREADY_EXISTS) with patch.object(_file, "error_check", side_effect=raise_): - path = text_type(path) # pylint: disable=redefined-variable-type + path = text_type(path) handle = CreateFile( path, 0, dwCreationDisposition=library.CREATE_ALWAYS) self.addCleanup(os.remove, path) @@ -235,7 +235,7 @@ def setUp(self): os.close(fd) self.addCleanup(os.remove, path) _, library = dist.load() - path = text_type(path) # pylint: disable=redefined-variable-type + path = text_type(path) self.handle = CreateFile(path, library.GENERIC_WRITE) self.assert_last_error(library.ERROR_ALREADY_EXISTS) self.addCleanup(CloseHandle, self.handle) diff --git a/tests/test_kernel32/test_synchronization.py b/tests/test_kernel32/test_synchronization.py index c0a4367..5797692 100644 --- a/tests/test_kernel32/test_synchronization.py +++ b/tests/test_kernel32/test_synchronization.py @@ -21,6 +21,7 @@ def test_wait_failed(self): with self.assertRaises(WindowsAPIError) as exec_: WaitForSingleObject(hProcess, 3) + # pylint: disable=no-member self.assertEqual(exec_.code, library.WAIT_FAILED) self.assertEqual(self.GetLastError()[0], library.ERROR_ACCESS_DENIED)