File: 0002-pytest.mark.online-tests-that-need-internet.patch

package info (click to toggle)
vcr.py 4.2.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,008 kB
  • sloc: python: 5,695; makefile: 179; sh: 1
file content (96 lines) | stat: -rw-r--r-- 3,372 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
From: Jochen Sprickerhof <jspricke@debian.org>
Date: Fri, 16 Dec 2022 18:55:56 +0100
Subject: pytest.mark.online tests that need internet

---
 tests/integration/test_httplib2.py | 1 +
 tests/integration/test_urllib2.py  | 2 ++
 tests/integration/test_urllib3.py  | 1 +
 tests/integration/test_wild.py     | 2 ++
 tests/unit/test_stubs.py           | 3 +++
 5 files changed, 9 insertions(+)

diff --git a/tests/integration/test_httplib2.py b/tests/integration/test_httplib2.py
index f7c06eb..e03550a 100644
--- a/tests/integration/test_httplib2.py
+++ b/tests/integration/test_httplib2.py
@@ -61,6 +61,7 @@ def test_response_headers(tmpdir, httpbin_both):
         assert set(headers) == set(resp.items())
 
 
+@pytest.mark.online
 def test_effective_url(tmpdir):
     """Ensure that the effective_url is captured"""
     url = "http://mockbin.org/redirect/301"
diff --git a/tests/integration/test_urllib2.py b/tests/integration/test_urllib2.py
index dd74bd5..bfa8b9d 100644
--- a/tests/integration/test_urllib2.py
+++ b/tests/integration/test_urllib2.py
@@ -4,6 +4,7 @@
 import ssl
 from urllib.request import urlopen
 from urllib.parse import urlencode
+from pytest import mark
 import pytest_httpbin.certs
 
 # Internal imports
@@ -56,6 +57,7 @@ def test_response_headers(httpbin_both, tmpdir):
         assert sorted(open1) == sorted(open2)
 
 
+@mark.online
 def test_effective_url(tmpdir):
     """Ensure that the effective_url is captured"""
     url = "http://mockbin.org/redirect/301"
diff --git a/tests/integration/test_urllib3.py b/tests/integration/test_urllib3.py
index 01de5a8..ba65612 100644
--- a/tests/integration/test_urllib3.py
+++ b/tests/integration/test_urllib3.py
@@ -94,6 +94,7 @@ def test_post(tmpdir, httpbin_both, verify_pool_mgr):
     assert req1 == req2
 
 
+@pytest.mark.online
 def test_redirects(tmpdir, verify_pool_mgr):
     """Ensure that we can handle redirects"""
     url = "http://mockbin.org/redirect/301"
diff --git a/tests/integration/test_wild.py b/tests/integration/test_wild.py
index 997b092..e8d9415 100644
--- a/tests/integration/test_wild.py
+++ b/tests/integration/test_wild.py
@@ -51,6 +51,7 @@ def test_flickr_multipart_upload(httpbin, tmpdir):
         assert cass.play_count == 1
 
 
+@pytest.mark.online
 def test_flickr_should_respond_with_200(tmpdir):
     testfile = str(tmpdir.join("flickr.yml"))
     with vcr.use_cassette(testfile):
@@ -68,6 +69,7 @@ def test_cookies(tmpdir, httpbin):
         assert len(r2.json()["cookies"]) == 2
 
 
+@pytest.mark.online
 def test_amazon_doctype(tmpdir):
     # amazon gzips its homepage.  For some reason, in requests 2.7, it's not
     # getting gunzipped.
diff --git a/tests/unit/test_stubs.py b/tests/unit/test_stubs.py
index da8061a..a40e73e 100644
--- a/tests/unit/test_stubs.py
+++ b/tests/unit/test_stubs.py
@@ -1,5 +1,7 @@
 from unittest import mock
 
+from pytest import mark
+
 from vcr import mode
 from vcr.stubs import VCRHTTPSConnection
 from vcr.cassette import Cassette
@@ -11,6 +13,7 @@ class TestVCRConnection:
         vcr_connection.ssl_version = "example_ssl_version"
         assert vcr_connection.real_connection.ssl_version == "example_ssl_version"
 
+    @mark.online
     @mock.patch("vcr.cassette.Cassette.can_play_response_for", return_value=False)
     def testing_connect(*args):
         vcr_connection = VCRHTTPSConnection("www.google.com")