Skip to content

Commit

Permalink
updated tests for travis
Browse files Browse the repository at this point in the history
Signed-off-by: Kenneth Reitz <me@kennethreitz.org>
  • Loading branch information
kennethreitz committed Feb 28, 2018
1 parent dcb828f commit e531e5c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ mypy = "*"

[scripts]

tests = "pytest"
tests = "pytest -v -m ok"
28 changes: 1 addition & 27 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions tests/test_requests_html.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os

import pytest
from requests_html import HTMLSession, HTML
from requests_file import FileAdapter

Expand All @@ -14,11 +15,13 @@ def get():
return session.get(url)


@pytest.mark.ok
def test_file_get():
r = get()
assert r.status_code == 200


@pytest.mark.ok
def test_css_selector():
r = get()

Expand All @@ -32,6 +35,7 @@ def test_css_selector():
assert menu_item in about.full_text.split('\n')


@pytest.mark.ok
def test_attrs():
r = get()
about = r.html.find('#about', first=True)
Expand All @@ -40,6 +44,7 @@ def test_attrs():
assert len(about.attrs['class']) == 2


@pytest.mark.ok
def test_links():
r = get()
about = r.html.find('#about', first=True)
Expand All @@ -48,12 +53,14 @@ def test_links():
assert len(about.absolute_links) == 6


@pytest.mark.ok
def test_search():
r = get()
style = r.html.search('Python is a {} language')[0]
assert style == 'programming'


@pytest.mark.ok
def test_xpath():
r = get()
html = r.html.xpath('/html', first=True)
Expand All @@ -63,6 +70,7 @@ def test_xpath():
assert '#site-map' in a_hrefs


@pytest.mark.ok
def test_html_loading():
doc = """<a href='https://httpbin.org'>"""
html = HTML(html=doc)
Expand All @@ -72,13 +80,15 @@ def test_html_loading():
assert isinstance(html.html, str)


@pytest.mark.ok
def test_anchor_links():
r = get()
r.html.skip_anchors = False

assert '#site-map' in r.html.links


@pytest.mark.render
def test_render():
r = get()
script = """
Expand All @@ -98,6 +108,7 @@ def test_render():
assert len(about.links) == 6


@pytest.mark.render
def test_bare_render():
doc = """<a href='https://httpbin.org'>"""
html = HTML(html=doc)
Expand Down

0 comments on commit e531e5c

Please sign in to comment.