From d7ecd992ceaad4d8401ea7f83da09d7e360c0e5c Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Tue, 3 Mar 2020 11:36:33 -0300 Subject: [PATCH 1/6] Use explicit requirements in the setup.py file. --- setup.py | 37 ++++++++++++------------------------- 1 file changed, 12 insertions(+), 25 deletions(-) diff --git a/setup.py b/setup.py index 16fd185..855bcb7 100644 --- a/setup.py +++ b/setup.py @@ -1,34 +1,21 @@ """This module contains the packaging routine for the pybook package""" from setuptools import setup, find_packages -try: - from pip.download import PipSession - from pip.req import parse_requirements -except ImportError: - # It is quick hack to support pip 10 that has changed its internal - # structure of the modules. - from pip._internal.download import PipSession - from pip._internal.req.req_file import parse_requirements +requirements = [ + "scrapy>=1.0.0", + "selenium>=3.9.0", +] -def get_requirements(source): - """Get the requirements from the given ``source`` - - Parameters - ---------- - source: str - The filename containing the requirements - - """ - - install_reqs = parse_requirements(filename=source, session=PipSession()) - - return [str(ir.req) for ir in install_reqs] - +test_requirements = [ + "pytest==3.4.0", + "coverage<4.4", + "pytest-cov==2.4.0", + "codeclimate-test-reporter==0.2.3", + "attrs>=17.4.0", +] setup( packages=find_packages(), - install_requires=get_requirements('requirements/requirements.txt') + install_requires=requirements, ) - - From 218311ba87fdd49fcc40f6d9a1f49dec6bd2c7b2 Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Tue, 3 Mar 2020 15:06:44 -0300 Subject: [PATCH 2/6] Call pytest when run python setup test. Also adjust tests_require instruction and don't stick to an specific pytest version. --- setup.cfg | 6 ++++++ setup.py | 27 +++++++++++++-------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/setup.cfg b/setup.cfg index 2ca31e9..336c7f0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -11,3 +11,9 @@ include_package_data = true [pep8] max-line-length = 100 + +[aliases] +test=pytest + +[tool:pytest] +addopts = --cov-config .coveragerc --cov=scrapy_selenium tests/ diff --git a/setup.py b/setup.py index 855bcb7..8e3b98d 100644 --- a/setup.py +++ b/setup.py @@ -2,20 +2,19 @@ from setuptools import setup, find_packages -requirements = [ - "scrapy>=1.0.0", - "selenium>=3.9.0", -] - -test_requirements = [ - "pytest==3.4.0", - "coverage<4.4", - "pytest-cov==2.4.0", - "codeclimate-test-reporter==0.2.3", - "attrs>=17.4.0", -] - setup( packages=find_packages(), - install_requires=requirements, + setup_requires=[ + "pytest-runner", + ], + install_requires=[ + "scrapy>=1.0.0", + "selenium>=3.9.0", + ], + tests_require=[ + "pytest", + "coverage", + "pytest-cov", + "codeclimate-test-reporter", + ] ) From aa0a119e71e91d73704dbcfd22ee2e1544c379e2 Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Tue, 3 Mar 2020 15:08:29 -0300 Subject: [PATCH 3/6] Trigger setup.py in the travis CI. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 485bc02..4446b59 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,7 +25,7 @@ before_script: - "export DISPLAY=:99.0" script: -- pytest --cov-config .coveragerc --cov=scrapy_selenium tests/ +- python setup.py test - codeclimate-test-reporter notifications: From 29540e906ac9a93a5ddeb11f65ed32d0a748e3c6 Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Tue, 3 Mar 2020 15:11:56 -0300 Subject: [PATCH 4/6] Remove requirements file. --- .travis.yml | 3 --- MANIFEST.in | 1 - requirements/requirements-test.txt | 7 ------- requirements/requirements.txt | 2 -- 4 files changed, 13 deletions(-) delete mode 100644 requirements/requirements-test.txt delete mode 100644 requirements/requirements.txt diff --git a/.travis.yml b/.travis.yml index 4446b59..9794f9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,9 +14,6 @@ python: addons: firefox: "49.0.2" -install: -- pip install -r requirements/requirements-test.txt - before_script: - wget https://github.com/mozilla/geckodriver/releases/download/v0.11.1/geckodriver-v0.11.1-linux64.tar.gz - mkdir geckodriver diff --git a/MANIFEST.in b/MANIFEST.in index 2b3aaa6..e69de29 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +0,0 @@ -include requirements/requirements.txt diff --git a/requirements/requirements-test.txt b/requirements/requirements-test.txt deleted file mode 100644 index 2addc1f..0000000 --- a/requirements/requirements-test.txt +++ /dev/null @@ -1,7 +0,0 @@ --r requirements.txt - -pytest==3.4.0 -coverage<4.4 -pytest-cov==2.4.0 -codeclimate-test-reporter==0.2.3 -attrs>=17.4.0 diff --git a/requirements/requirements.txt b/requirements/requirements.txt deleted file mode 100644 index e6e2710..0000000 --- a/requirements/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -scrapy>=1.0.0 -selenium>=3.9.0 From d9cfc27dd4178a13c79709be6ebb149ae0a0f391 Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Tue, 3 Mar 2020 15:26:04 -0300 Subject: [PATCH 5/6] Change to the new code climate test reporter. --- .travis.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9794f9f..4068c26 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,12 +4,12 @@ services: env: global: - - CODECLIMATE_REPO_TOKEN=a47935830d841ad61a6e960be8a3b6a5e557146ac010dafa993e61bf82898472 + - CODECLIMATE_REPO_TOKEN=a47935830d841ad61a6e960be8a3b6a5e557146ac010dafa993e61bf82898472 language: python python: -- 3.6 + - 3.6 addons: firefox: "49.0.2" @@ -20,10 +20,15 @@ before_script: - tar -xzf geckodriver-v0.11.1-linux64.tar.gz -C geckodriver - export PATH=$PATH:$PWD/geckodriver - "export DISPLAY=:99.0" + - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + - chmod +x ./cc-test-reporter + - ./cc-test-reporter before-build script: -- python setup.py test -- codeclimate-test-reporter + - python setup.py test + +after_script: + - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT notifications: email: false From 68095af02db7e83c580595373ff582785e5f5e32 Mon Sep 17 00:00:00 2001 From: Michel Sabchuk Date: Tue, 3 Mar 2020 15:33:50 -0300 Subject: [PATCH 6/6] Adjust variable name for the repo test id. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 4068c26..dccfca1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ services: env: global: - - CODECLIMATE_REPO_TOKEN=a47935830d841ad61a6e960be8a3b6a5e557146ac010dafa993e61bf82898472 + - CC_TEST_REPORTER_ID=a47935830d841ad61a6e960be8a3b6a5e557146ac010dafa993e61bf82898472 language: python