Skip to content

Commit e789aa9

Browse files
committed
Merge branch 'master' of github.com:hartym/bonobo-selenium
2 parents d4f5039 + 48f776a commit e789aa9

File tree

12 files changed

+175
-103
lines changed

12 files changed

+175
-103
lines changed

.coveragerc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
[run]
2+
branch = True
3+
4+
[report]
5+
# Regexes for lines to exclude from consideration
6+
exclude_lines =
7+
# Have to re-enable the standard pragma
8+
pragma: no cover
9+
10+
# Don't complain about missing debug-only code:
11+
def __repr__
12+
if self\.debug
13+
14+
# Don't complain if tests don't hit defensive assertion code:
15+
raise AbstractError
16+
raise AssertionError
17+
raise NotImplementedError
18+
19+
# Don't complain if non-runnable code isn't run:
20+
if 0:
21+
if __name__ == .__main__.:
22+
23+
ignore_errors = True
24+
25+
[html]
26+
directory = docs/_build/html/coverage

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*,cover
44
*.egg
55
*.egg-info/
6+
*.iml
67
*.log
78
*.manifest
89
*.mo

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ install:
99
- make install-dev
1010
- pip install coveralls
1111
script:
12-
- make clean docs test
12+
- make clean test
1313
after_success:
1414
- coveralls

Makefile

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,44 @@
11
# This file has been auto-generated.
22
# All changes will be lost, see Projectfile.
33
#
4-
# Updated at 2016-12-28 13:00:03.652442
4+
# Updated at 2017-06-11 11:44:27.482152
55

6+
PACKAGE ?= bonobo_selenium
67
PYTHON ?= $(shell which python)
78
PYTHON_BASENAME ?= $(shell basename $(PYTHON))
9+
PYTHON_DIRNAME ?= $(shell dirname $(PYTHON))
810
PYTHON_REQUIREMENTS_FILE ?= requirements.txt
911
PYTHON_REQUIREMENTS_DEV_FILE ?= requirements-dev.txt
1012
QUICK ?=
11-
VIRTUAL_ENV ?= .virtualenv-$(PYTHON_BASENAME)
12-
PIP ?= $(VIRTUAL_ENV)/bin/pip
13-
PYTEST ?= $(VIRTUAL_ENV)/bin/pytest
14-
PYTEST_OPTIONS ?= --capture=no --cov=bonobo_selenium --cov-report html
15-
SPHINX_OPTS ?=
16-
SPHINX_BUILD ?= $(VIRTUAL_ENV)/bin/sphinx-build
17-
SPHINX_SOURCEDIR ?= docs
18-
SPHINX_BUILDDIR ?= $(SPHINX_SOURCEDIR)/_build
13+
PIP ?= $(PYTHON_DIRNAME)/pip
14+
PIP_INSTALL_OPTIONS ?=
15+
PYTEST ?= $(PYTHON_DIRNAME)/pytest
16+
PYTEST_OPTIONS ?= --capture=no --cov=$(PACKAGE) --cov-report html
17+
YAPF ?= $(PYTHON) -m yapf
18+
YAPF_OPTIONS ?= -rip
19+
VERSION ?= $(shell git describe 2>/dev/null || echo dev)
1920

20-
.PHONY: $(SPHINX_SOURCEDIR) clean install install-dev lint test
21+
.PHONY: clean format install install-dev test
2122

2223
# Installs the local project dependencies.
23-
install: $(VIRTUAL_ENV)
24+
install:
2425
if [ -z "$(QUICK)" ]; then \
25-
$(PIP) install -Ur $(PYTHON_REQUIREMENTS_FILE) ; \
26+
$(PIP) install -U pip wheel $(PYTHON_PIP_INSTALL_OPTIONS) -r $(PYTHON_REQUIREMENTS_FILE) ; \
2627
fi
2728

2829
# Installs the local project dependencies, including development-only libraries.
29-
install-dev: $(VIRTUAL_ENV)
30+
install-dev:
3031
if [ -z "$(QUICK)" ]; then \
31-
$(PIP) install -Ur $(PYTHON_REQUIREMENTS_DEV_FILE) ; \
32+
$(PIP) install -U pip wheel $(PYTHON_PIP_INSTALL_OPTIONS) -r $(PYTHON_REQUIREMENTS_DEV_FILE) ; \
3233
fi
3334

3435
# Cleans up the local mess.
3536
clean:
36-
rm -rf build
37-
rm -rf dist
38-
39-
# Setup the local virtualenv, or use the one provided by the current environment.
40-
$(VIRTUAL_ENV):
41-
virtualenv -p $(PYTHON) $(VIRTUAL_ENV)
42-
$(PIP) install -U pip\>=8.1.2,\<9 wheel\>=0.29,\<1.0
43-
ln -fs $(VIRTUAL_ENV)/bin/activate activate-$(PYTHON_BASENAME)
44-
45-
lint: install-dev
46-
$(VIRTUAL_ENV)/bin/pylint --py3k bonobo_selenium -f html > pylint.html
37+
rm -rf build dist *.egg-info
4738

4839
test: install-dev
4940
$(PYTEST) $(PYTEST_OPTIONS) tests
5041

51-
$(SPHINX_SOURCEDIR): install-dev
52-
$(SPHINX_BUILD) -b html -D latex_paper_size=a4 $(SPHINX_OPTS) $(SPHINX_SOURCEDIR) $(SPHINX_BUILDDIR)/html
42+
format: install-dev
43+
$(YAPF) $(YAPF_OPTIONS) .
44+
$(YAPF) $(YAPF_OPTIONS) Projectfile

Projectfile

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,26 @@
11
# bonobo-selenium (see github.com/python-bonobo/bonobo-selenium)
22

3-
name = 'bonobo_selenium'
4-
description = 'Bonobo Selenium Extension'
5-
license = 'Apache License, Version 2.0'
3+
from edgy.project import require
64

7-
url = 'https://bonobo-project.org/'
8-
download_url = 'https://github.com/python-bonobo/bonobo-selenium/tarball/{version}'
5+
pytest = require('pytest')
6+
python = require('python')
7+
yapf = require('yapf')
98

10-
author = 'Romain Dorgueil'
11-
author_email = 'romain@dorgueil.net'
9+
python.setup(
10+
name='bonobo_selenium',
11+
description='Bonobo Selenium Extension',
12+
license='Apache License, Version 2.0',
13+
url='https://bonobo-project.org/with/selenium',
14+
download_url='https://github.com/python-bonobo/bonobo-selenium/tarball/{version}',
15+
author='Romain Dorgueil',
16+
author_email='romain@dorgueil.net', )
1217

13-
enable_features = {
14-
'make',
15-
'sphinx',
16-
'pytest',
17-
'git',
18-
'pylint',
19-
'python',
20-
}
18+
bonobo_version = '>=0.4,<0.5'
19+
python.add_requirements(
20+
'bonobo ' + bonobo_version,
21+
'selenium >=3.4,<3.5',
22+
dev=[
23+
'bonobo[dev] ' + bonobo_version,
24+
], )
2125

22-
install_requires = [
23-
'bonobo',
24-
'selenium >=3.0.2,<3.1',
25-
]
26-
27-
extras_require = {
28-
'dev': [
29-
'coverage >=4.2,<4.3',
30-
'mock >=2.0,<2.1',
31-
'nose >=1.3,<1.4',
32-
'pylint >=1.6,<1.7',
33-
'pytest >=3,<4',
34-
'pytest-cov >=2.4,<2.5',
35-
'sphinx',
36-
'sphinx_rtd_theme',
37-
'yapf',
38-
],
39-
}
40-
41-
@listen('edgy.project.feature.make.on_generate', priority=10)
42-
def on_make_generate_docker_targets(event):
43-
event.makefile['SPHINX_SOURCEDIR'] = 'docs'
26+
# vim: ft=python:

bonobo_selenium/__init__.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import selenium.webdriver
22

3-
from bonobo import service
3+
from bonobo._version import __version__
44

55
USER_AGENT = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/601.4.4 (KHTML, like Gecko) Version/9.0.3 Safari/601.4.4'
66

@@ -23,16 +23,18 @@ def create_profile(use_tor=False):
2323

2424
def create_browser(profile):
2525
_browser = selenium.webdriver.Firefox(profile)
26-
_browser.implicitly_wait(10)
27-
_browser.set_page_load_timeout(10)
26+
# _browser.implicitly_wait(10)
27+
# _browser.set_page_load_timeout(10)
2828
return _browser
2929

30+
def create_chrome_browser():
31+
browser = selenium.webdriver.Chrome()
32+
return browser
3033

31-
@service
32-
def browser():
33-
return create_browser(create_profile(use_tor=False))
3434

35-
36-
@service
37-
def torbrowser():
38-
return create_browser(create_profile(use_tor=True))
35+
__all__ = [
36+
'USER_AGENT',
37+
'__version__',
38+
'create_browser',
39+
'create_profile',
40+
]

bonobo_selenium/_version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__version__ = '0.1.0'

requirements-dev.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
11
-e .[dev]
2+
appdirs==1.4.3
3+
bonobo==0.4.1
4+
certifi==2017.4.17
5+
chardet==3.0.4
6+
colorama==0.3.9
7+
coverage==4.4.1
8+
enum34==1.1.6
9+
fs==2.0.3
10+
idna==2.5
11+
packaging==16.8
12+
pbr==3.0.1
13+
psutil==5.2.2
14+
py==1.4.34
15+
pyparsing==2.2.0
16+
pytest-cov==2.5.1
17+
pytest==3.1.2
18+
pytz==2017.2
19+
requests==2.17.3
20+
six==1.10.0
21+
stevedore==1.23.0
22+
urllib3==1.21.1

requirements.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,19 @@
11
-e .
2+
appdirs==1.4.3
3+
bonobo==0.4.1
4+
certifi==2017.4.17
5+
chardet==3.0.4
6+
colorama==0.3.9
7+
enum34==1.1.6
8+
fs==2.0.3
9+
idna==2.5
10+
packaging==16.8
11+
pbr==3.0.1
12+
psutil==5.2.2
13+
pyparsing==2.2.0
14+
pytz==2017.2
15+
requests==2.17.3
16+
selenium==3.4.3
17+
six==1.10.0
18+
stevedore==1.23.0
19+
urllib3==1.21.1

setup.py

Lines changed: 49 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,59 @@
22
# All changes will be overwritten.
33

44
from setuptools import setup, find_packages
5+
from codecs import open
6+
from os import path
7+
8+
here = path.abspath(path.dirname(__file__))
9+
10+
# Py3 compatibility hacks, borrowed from IPython.
11+
try:
12+
execfile
13+
except NameError:
14+
15+
def execfile(fname, globs, locs=None):
16+
locs = locs or globs
17+
exec(compile(open(fname).read(), fname, "exec"), globs, locs)
518

6-
tolines = lambda c: list(filter(None, map(lambda s: s.strip(), c.split('\n'))))
719

8-
def read(filename, flt=None):
9-
with open(filename) as f:
10-
content = f.read().strip()
11-
return flt(content) if callable(flt) else content
20+
# Get the long description from the README file
21+
try:
22+
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
23+
long_description = f.read()
24+
except:
25+
long_description = ''
26+
27+
# Get the classifiers from the classifiers file
28+
tolines = lambda c: list(filter(None, map(lambda s: s.strip(), c.split('\n'))))
29+
try:
30+
with open(path.join(here, 'classifiers.txt'), encoding='utf-8') as f:
31+
classifiers = tolines(f.read())
32+
except:
33+
classifiers = []
1234

35+
version_ns = {}
1336
try:
14-
version = read('version.txt')
15-
except: # pylint: disable=bare-except
37+
execfile(path.join(here, 'bonobo_selenium/_version.py'), version_ns)
38+
except EnvironmentError:
1639
version = 'dev'
40+
else:
41+
version = version_ns.get('__version__', 'dev')
1742

1843
setup(
19-
name = 'bonobo_selenium',
20-
description = 'Bonobo Selenium Extension',
21-
license = 'Apache License, Version 2.0',
22-
install_requires = ['bonobo', 'selenium >=3.0.2,<3.1'],
23-
version = version,
24-
long_description = read('README.rst'),
25-
classifiers = read('classifiers.txt', tolines),
26-
packages = find_packages(exclude=['ez_setup', 'example', 'test']),
27-
include_package_data = True,
28-
extras_require = {'dev': ['coverage >=4.2,<4.3',
29-
'mock >=2.0,<2.1',
30-
'nose >=1.3,<1.4',
31-
'pylint >=1.6,<1.7',
32-
'pytest >=3,<4',
33-
'pytest-cov >=2.4,<2.5',
34-
'sphinx',
35-
'sphinx_rtd_theme',
36-
'yapf']},
37-
url = 'https://bonobo-project.org/',
38-
download_url = 'https://github.com/python-bonobo/bonobo-selenium/tarball/{version}'.format(version=version),
39-
)
44+
author='Romain Dorgueil',
45+
author_email='romain@dorgueil.net',
46+
description='Bonobo Selenium Extension',
47+
license='Apache License, Version 2.0',
48+
name='bonobo_selenium',
49+
version=version,
50+
long_description=long_description,
51+
classifiers=classifiers,
52+
packages=find_packages(exclude=['ez_setup', 'example', 'test']),
53+
include_package_data=True,
54+
install_requires=['bonobo (>= 0.4, < 0.5)', 'selenium (>= 3.4, < 3.5)'],
55+
extras_require={
56+
'dev':
57+
['bonobo (>= 0.4, < 0.5)', 'coverage (>= 4.4, < 5.0)', 'pytest (>= 3.1, < 4.0)', 'pytest-cov (>= 2.5, < 3.0)']
58+
},
59+
url='https://bonobo-project.org/with/selenium',
60+
download_url='https://github.com/python-bonobo/bonobo-selenium/tarball/{version}'.format(version=version), )

0 commit comments

Comments
 (0)