Skip to content

Commit

Permalink
Clean up project. (#11)
Browse files Browse the repository at this point in the history
* Store test dependencies in setup.py
* Fix author e-mail.
* Fix tests by pinning some maximum versions (They will be removed when solving #6.)
* Fix handling of empty responses.
* Update travis config.
  • Loading branch information
Michael Howitz committed Feb 27, 2019
1 parent 929bd78 commit dc5d49d
Show file tree
Hide file tree
Showing 11 changed files with 79 additions and 47 deletions.
9 changes: 9 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[run]
branch = True
source = z3c.etestbrowser

[report]
precision = 2

[html]
directory = htmlcov
15 changes: 8 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
.installed.cfg
*.egg-info
*.pyc
.Python
include/
lib/
.coverage
.installed.cfg
.tox/
__pycache__
bin/
develop-eggs/
eggs/
*.egg-info
*.pyc
__pycache__
.tox/
include/
lib/
25 changes: 19 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
# Configuration script to Travis-CI
sudo: false
# Configuration script for Travis-CI
language: python
python:
- 2.7
- 2.7
matrix:
include:
- python: 2.7
name: "2.7"
- python: 2.7
name: "Flake8"
install: pip install -U flake8
script: flake8 --doctests src setup.py
after_success:
install:
- pip install tox-travis
- pip install -U pip setuptools zope.testrunner
- pip install -U coveralls coverage
- pip install -U -e ".[test]"
script:
- tox
- coverage run -m zope.testrunner --test-path=src --auto-color
after_success:
- coveralls
notifications:
email: false
email: false
cache: pip
8 changes: 5 additions & 3 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
CHANGES
=======

2.0.2 (unreleased)
==================
2.1 (unreleased)
================

- Nothing changed yet.
- Adapt the code to newer ``lxml`` versions which no longer raise an exception
if the string to be parsed by ``lxml.etree`` is empty. We now raise a
``ValueError`` in this case.


2.0.1 (2015-11-09)
Expand Down
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This package is intended to provide extended versions of the Zope 3
testbrowser_. Especially those extensions that introduce dependencies to more
external products, like lxml.

.. _testbrowser: http://pypi.python.org/pypi/zope.testbrowser
.. _testbrowser: https://pypi.org/project/zope.testbrowser/

.. contents::

Expand Down
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[bdist_wheel]
universal = 1

[flake8]
doctests = true
27 changes: 12 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,27 @@
"""Setup for z3c.etestbrowser package."""

import os
import ConfigParser
from setuptools import setup, find_packages


def here(*rnames):
return os.path.join(os.path.dirname(__file__), *rnames)


def read(*rnames):
with open(here(*rnames)) as f:
with open(os.path.join(*rnames)) as f:
return f.read()


def get_test_requires():
parser = ConfigParser.ConfigParser()
parser.read([here('tox.ini')])
return parser.get('testenv', 'deps')

test_requires = get_test_requires()
test_requires = [
'zope.testrunner',
'zope.app.testing < 4',
'zope.app.wsgi[testlayer] >= 4.0dev',
'zope.app.zcmlfiles',
'zope.app.server',
'zope.testbrowser[test]',
]

setup(name='z3c.etestbrowser',
version='2.0.2.dev0',
version='2.1.dev0',
author='Christian Theune',
author_email='ct@gocept.com',
author_email='mail@gocept.com',
description='Extensions for zope.testbrowser',
long_description=(
read('README.txt') + '\n\n' +
Expand Down Expand Up @@ -68,7 +65,7 @@ def get_test_requires():
tests_require=test_requires,
extras_require={
"test": test_requires,
"zope.app.testing": ["zope.app.testing"],
"zope.app.testing": ["zope.app.testing < 4.0"],
},
install_requires=[
'setuptools',
Expand Down
4 changes: 2 additions & 2 deletions src/z3c/etestbrowser/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ general TestBrowser use:
''
>>> browser.etree
Traceback (most recent call last):
XMLSyntaxError: ...
ValueError: ...
>>> browser.normalized_contents
Traceback (most recent call last):
XMLSyntaxError: ...
ValueError: ...


Pretty printing
Expand Down
3 changes: 3 additions & 0 deletions src/z3c/etestbrowser/browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ def etree(self):
content = content.decode(charset)
self._etree = lxml.etree.HTML(content)

if self._etree is None:
raise ValueError(
'ETree could not be constructed. Contents might be empty.')
return self._etree

@property
Expand Down
1 change: 1 addition & 0 deletions src/z3c/etestbrowser/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ class Browser(zope.testbrowser.wsgi.Browser,
"""


# Just for backwards compatibility with versions before 2.0:
ExtendedTestBrowser = Browser
27 changes: 14 additions & 13 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
[tox]
envlist =
py27,flake8
flake8,
py27,
coverage,

[testenv]
deps =
zope.testrunner
zope.app.testing
zope.app.wsgi >= 4.0dev
zope.app.zcmlfiles
zope.app.server
zope.testbrowser[test]
# install zope.app.pagetemplate explicitly to avoid
# https://github.com/pypa/pip/issues/854
extras = test
commands =
pip install zope.app.pagetemplate
zope-testrunner --test-path=src

[testenv:coverage]
basepython = python2.7
commands =
coverage run -m zope.testrunner --test-path=src {posargs:--auto-color -vv}
coverage report --fail-under=92
deps = coverage

[testenv:flake8]
basepython = python2
basepython = python2.7
skip_install = true
deps = flake8
commands = flake8 src setup.py --doctests
commands = flake8 src setup.py

0 comments on commit dc5d49d

Please sign in to comment.