Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hardcode setup.py requirements to avoid use pip internals #57

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,31 @@ services:

env:
global:
- CODECLIMATE_REPO_TOKEN=a47935830d841ad61a6e960be8a3b6a5e557146ac010dafa993e61bf82898472
- CC_TEST_REPORTER_ID=a47935830d841ad61a6e960be8a3b6a5e557146ac010dafa993e61bf82898472

language: python

python:
- 3.6
- 3.6

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
- 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:
- pytest --cov-config .coveragerc --cov=scrapy_selenium tests/
- codeclimate-test-reporter
- python setup.py test

after_script:
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT

notifications:
email: false
1 change: 0 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
include requirements/requirements.txt
7 changes: 0 additions & 7 deletions requirements/requirements-test.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/requirements.txt

This file was deleted.

6 changes: 6 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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/
40 changes: 13 additions & 27 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
"""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


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]


setup(
packages=find_packages(),
install_requires=get_requirements('requirements/requirements.txt')
setup_requires=[
"pytest-runner",
],
install_requires=[
"scrapy>=1.0.0",
"selenium>=3.9.0",
],
tests_require=[
"pytest",
"coverage",
"pytest-cov",
"codeclimate-test-reporter",
]
)