Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
a7e182f9
Commit
a7e182f9
authored
Oct 02, 2022
by
Bjorn Neergaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tests: properly use and cleanup httpretty
parent
27531c1f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
8 deletions
+4
-8
tests/conftest.py
+1
-5
tests/utils/test_authenticator.py
+3
-3
No files found.
tests/conftest.py
View file @
a7e182f9
...
@@ -275,13 +275,9 @@ def git_mock(mocker: MockerFixture) -> None:
...
@@ -275,13 +275,9 @@ def git_mock(mocker: MockerFixture) -> None:
@pytest.fixture
@pytest.fixture
def
http
()
->
Iterator
[
type
[
httpretty
.
httpretty
]]:
def
http
()
->
Iterator
[
type
[
httpretty
.
httpretty
]]:
httpretty
.
reset
()
httpretty
.
reset
()
httpretty
.
enable
(
allow_net_connect
=
False
)
with
httpretty
.
enabled
(
allow_net_connect
=
False
):
yield
httpretty
yield
httpretty
httpretty
.
activate
()
httpretty
.
reset
()
@pytest.fixture
@pytest.fixture
def
fixture_base
()
->
Path
:
def
fixture_base
()
->
Path
:
...
...
tests/utils/test_authenticator.py
View file @
a7e182f9
...
@@ -215,7 +215,7 @@ def test_authenticator_request_retries_on_exception(
...
@@ -215,7 +215,7 @@ def test_authenticator_request_retries_on_exception(
raise
requests
.
exceptions
.
ConnectionError
(
"Disconnected"
)
raise
requests
.
exceptions
.
ConnectionError
(
"Disconnected"
)
return
[
200
,
response_headers
,
content
]
return
[
200
,
response_headers
,
content
]
http
retty
.
register_uri
(
httpretty
.
GET
,
sdist_uri
,
body
=
callback
)
http
.
register_uri
(
httpretty
.
GET
,
sdist_uri
,
body
=
callback
)
authenticator
=
Authenticator
(
config
,
NullIO
())
authenticator
=
Authenticator
(
config
,
NullIO
())
response
=
authenticator
.
request
(
"get"
,
sdist_uri
)
response
=
authenticator
.
request
(
"get"
,
sdist_uri
)
...
@@ -233,7 +233,7 @@ def test_authenticator_request_raises_exception_when_attempts_exhausted(
...
@@ -233,7 +233,7 @@ def test_authenticator_request_raises_exception_when_attempts_exhausted(
def
callback
(
*
_
:
Any
,
**
___
:
Any
)
->
None
:
def
callback
(
*
_
:
Any
,
**
___
:
Any
)
->
None
:
raise
requests
.
exceptions
.
ConnectionError
(
str
(
uuid
.
uuid4
()))
raise
requests
.
exceptions
.
ConnectionError
(
str
(
uuid
.
uuid4
()))
http
retty
.
register_uri
(
httpretty
.
GET
,
sdist_uri
,
body
=
callback
)
http
.
register_uri
(
httpretty
.
GET
,
sdist_uri
,
body
=
callback
)
authenticator
=
Authenticator
(
config
,
NullIO
())
authenticator
=
Authenticator
(
config
,
NullIO
())
with
pytest
.
raises
(
requests
.
exceptions
.
ConnectionError
):
with
pytest
.
raises
(
requests
.
exceptions
.
ConnectionError
):
...
@@ -271,7 +271,7 @@ def test_authenticator_request_retries_on_status_code(
...
@@ -271,7 +271,7 @@ def test_authenticator_request_retries_on_status_code(
)
->
list
[
int
|
dict
|
str
]:
)
->
list
[
int
|
dict
|
str
]:
return
[
status
,
response_headers
,
content
]
return
[
status
,
response_headers
,
content
]
http
retty
.
register_uri
(
httpretty
.
GET
,
sdist_uri
,
body
=
callback
)
http
.
register_uri
(
httpretty
.
GET
,
sdist_uri
,
body
=
callback
)
authenticator
=
Authenticator
(
config
,
NullIO
())
authenticator
=
Authenticator
(
config
,
NullIO
())
with
pytest
.
raises
(
requests
.
exceptions
.
HTTPError
)
as
excinfo
:
with
pytest
.
raises
(
requests
.
exceptions
.
HTTPError
)
as
excinfo
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment