Skip to content

Commit

Permalink
test package install on travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Knio committed Mar 25, 2014
1 parent 96560f2 commit f63d63c
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 361 deletions.
6 changes: 4 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ python:
- "2.7"
- "3.3"
# - "3.4"
# - "pypy"
- "pypy"

# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install:
- pip install pytest

# command to run tests, e.g. python setup.py test
script:
- PYTHONPATH=. py.test
- python setup.py sdist --format=zip
- pip install dist/dominate*.zip
- py.test

after_success:
- pip install coveralls coverage
Expand Down
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,12 @@
'License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: Text Processing :: Markup :: HTML',
Expand Down
152 changes: 76 additions & 76 deletions tests/test_document.py
Original file line number Diff line number Diff line change
@@ -1,76 +1,76 @@
from dominate import document
from dominate.tags import *

def test_doc():
d = document()
assert d.render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body></body>
</html>'''


def test_decorator():
@document()
def foo():
p('Hello World')

f = foo()
assert f.render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>'''


def test_bare_decorator():
@document
def foo():
p('Hello World')

assert foo().render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>'''


def test_title():
d = document()
assert d.title == 'Dominate'

d = document(title='foobar')
assert d.title == 'foobar'

d.title = 'baz'
assert d.title == 'baz'

d.title = title('bar')
assert d.title == 'bar'

assert d.render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>bar</title>
</head>
<body></body>
</html>'''


if __name__ == '__main__':
# test_doc()
test_decorator()
from dominate import document
from dominate.tags import *

def test_doc():
d = document()
assert d.render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body></body>
</html>'''


def test_decorator():
@document()
def foo():
p('Hello World')

f = foo()
assert f.render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>'''


def test_bare_decorator():
@document
def foo():
p('Hello World')

assert foo().render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>Dominate</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>'''


def test_title():
d = document()
assert d.title == 'Dominate'

d = document(title='foobar')
assert d.title == 'foobar'

d.title = 'baz'
assert d.title == 'baz'

d.title = title('bar')
assert d.title == 'bar'

assert d.render() == \
'''<!DOCTYPE html>
<html>
<head>
<title>bar</title>
</head>
<body></body>
</html>'''


if __name__ == '__main__':
# test_doc()
test_decorator()
32 changes: 16 additions & 16 deletions tests/test_dom1core.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from dominate.tags import *

def test_dom():
container = div()
with container.add(div(id='base')) as dom:
s1 = span('Hello', id='span1')
s2 = span('World', id='span2')

s3 = span('foobar', id='span3')
dom.appendChild(s3)

assert container.getElementById('base') is dom
assert container.getElementById('span1') is s1
assert container.getElementById('span3') is s3
assert container.getElementsByTagName('span') == [s1, s2, s3]
assert container.getElementsByTagName('SPAN') == [s1, s2, s3]
from dominate.tags import *

def test_dom():
container = div()
with container.add(div(id='base')) as dom:
s1 = span('Hello', id='span1')
s2 = span('World', id='span2')

s3 = span('foobar', id='span3')
dom.appendChild(s3)

assert container.getElementById('base') is dom
assert container.getElementById('span1') is s1
assert container.getElementById('span3') is s3
assert container.getElementsByTagName('span') == [s1, s2, s3]
assert container.getElementsByTagName('SPAN') == [s1, s2, s3]

0 comments on commit f63d63c

Please sign in to comment.