1111from webtest .debugapp import debug_app
1212from unittest import TestCase
1313
14+ import pytest
15+
1416sys .path .insert (0 , os .path .dirname (os .path .dirname (__file__ )))
1517
1618
@@ -534,10 +536,9 @@ def test_val_for_textarea(self):
534536 self .assertEqual (d ('#textarea-multi' ).val (), multi_expected )
535537 self .assertEqual (d ('#textarea-multi' ).text (), multi_expected )
536538 multi_new = '''Bacon\n <b>Eggs</b>\n Spam'''
537- multi_new_expected = '''Bacon\n <b>Eggs</b>\n Spam'''
538539 d ('#textarea-multi' ).val (multi_new )
539- self .assertEqual (d ('#textarea-multi' ).val (), multi_new_expected )
540- self .assertEqual (d ('#textarea-multi' ).text (), multi_new_expected )
540+ self .assertEqual (d ('#textarea-multi' ).val (), multi_new )
541+ self .assertEqual (d ('#textarea-multi' ).text (), multi_new )
541542
542543 def test_val_for_select (self ):
543544 d = pq (self .html4 )
@@ -784,6 +785,7 @@ def test_make_link(self):
784785 'http://example.com/path_info' )
785786
786787
788+ @pytest .mark .skipif (os .name == 'nt' , reason = 'fail on windows' )
787789class TestHTMLParser (TestCase ):
788790 xml = "<div>I'm valid XML</div>"
789791 html = '''<div class="portlet">
@@ -802,7 +804,7 @@ def test_replaceWith(self):
802804 expected = '''<div class="portlet">
803805 <a href="/toto">TestimageMy link text</a>
804806 <a href="/toto2">imageMy link text 2</a>
805- Behind you, a three-headed HTML&dash; Entity!
807+ Behind you, a three-headed HTML‐ Entity!
806808 </div>'''
807809 d = pq (self .html )
808810 d ('img' ).replace_with ('image' )
@@ -813,7 +815,7 @@ def test_replaceWith_with_function(self):
813815 expected = '''<div class="portlet">
814816 TestimageMy link text
815817 imageMy link text 2
816- Behind you, a three-headed HTML&dash; Entity!
818+ Behind you, a three-headed HTML‐ Entity!
817819 </div>'''
818820 d = pq (self .html )
819821 d ('a' ).replace_with (lambda i , e : pq (e ).html ())
@@ -899,14 +901,14 @@ def test_get(self):
899901 d = pq (url = self .application_url , data = {'q' : 'foo' },
900902 method = 'get' )
901903 print (d )
902- self .assertIn ('REQUEST_METHOD: GET' , d ( 'p' ) .text ())
903- self .assertIn ('q=foo' , d ( 'p' ) .text ())
904+ self .assertIn ('REQUEST_METHOD: GET' , d .text ())
905+ self .assertIn ('q=foo' , d .text ())
904906
905907 def test_post (self ):
906908 d = pq (url = self .application_url , data = {'q' : 'foo' },
907909 method = 'post' )
908- self .assertIn ('REQUEST_METHOD: POST' , d ( 'p' ) .text ())
909- self .assertIn ('q=foo' , d ( 'p' ) .text ())
910+ self .assertIn ('REQUEST_METHOD: POST' , d .text ())
911+ self .assertIn ('q=foo' , d .text ())
910912
911913 def test_session (self ):
912914 if HAS_REQUEST :
@@ -915,7 +917,7 @@ def test_session(self):
915917 session .headers .update ({'X-FOO' : 'bar' })
916918 d = pq (url = self .application_url , data = {'q' : 'foo' },
917919 method = 'get' , session = session )
918- self .assertIn ('HTTP_X_FOO: bar' , d ( 'p' ) .text ())
920+ self .assertIn ('HTTP_X_FOO: bar' , d .text ())
919921 else :
920922 self .skipTest ('no requests library' )
921923
@@ -925,6 +927,7 @@ def tearDown(self):
925927
926928class TestWebScrappingEncoding (TestCase ):
927929
930+ @pytest .mark .skip ('No longer possible to query this url' )
928931 def test_get (self ):
929932 d = pq (url = 'http://ru.wikipedia.org/wiki/Заглавная_страница' ,
930933 method = 'get' )
0 commit comments