Skip to content

Commit

Permalink
Clean up project.
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 20, 2019
1 parent 929bd78 commit a8f41a4
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 36 deletions.
21 changes: 16 additions & 5 deletions .travis.yml
@@ -1,11 +1,22 @@
# Configuration script to Travis-CI
sudo: false
# Configuration script for Travis-CI
language: python
python:
- 2.7
matrix:
include:
- 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
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
27 changes: 12 additions & 15 deletions setup.py
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
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
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 emtpy.')
return self._etree

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


# Just for backwards compatibility with versions before 2.0:
ExtendedTestBrowser = Browser
14 changes: 3 additions & 11 deletions tox.ini
Expand Up @@ -3,20 +3,12 @@ envlist =
py27,flake8

[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:flake8]
basepython = python2
basepython = python2.7
skip_install = true
deps = flake8
commands = flake8 src setup.py --doctests

0 comments on commit a8f41a4

Please sign in to comment.