2222import sys
2323import tempfile
2424import unittest
25-
25+ from http . server import HTTPStatus
2626from unittest .mock import patch
2727from urllib .error import HTTPError
2828from urllib .request import Request
3131import pytest
3232from xdg import BaseDirectory
3333
34- from fades import HTTP_STATUS_NOT_FOUND , HTTP_STATUS_OK , helpers
35- from fades import parsing
34+ from fades import helpers , parsing
3635
3736
3837PATH_TO_EXAMPLES = "tests/examples/"
@@ -307,7 +306,7 @@ def test_exists(self):
307306
308307 with patch ('urllib.request.urlopen' ) as mock_urlopen :
309308 with patch ('http.client.HTTPResponse' ) as mock_http_response :
310- mock_http_response .status = HTTP_STATUS_OK
309+ mock_http_response .status = HTTPStatus . OK
311310 mock_urlopen .return_value = mock_http_response
312311
313312 exists = helpers .check_pypi_exists (deps )
@@ -319,7 +318,7 @@ def test_all_exists(self):
319318
320319 with patch ('urllib.request.urlopen' ) as mock_urlopen :
321320 with patch ('http.client.HTTPResponse' ) as mock_http_response :
322- mock_http_response .status = HTTP_STATUS_OK
321+ mock_http_response .status = HTTPStatus . OK
323322 mock_urlopen .side_effect = [mock_http_response ] * 3
324323
325324 exists = helpers .check_pypi_exists (dependencies )
@@ -330,7 +329,7 @@ def test_doesnt_exists(self):
330329 dependency = parsing .parse_manual (["foo" ])
331330
332331 with patch ('urllib.request.urlopen' ) as mock_urlopen :
333- mock_http_error = HTTPError ("url" , HTTP_STATUS_NOT_FOUND , "mgs" , {}, io .BytesIO ())
332+ mock_http_error = HTTPError ("url" , HTTPStatus . NOT_FOUND , "mgs" , {}, io .BytesIO ())
334333 mock_urlopen .side_effect = mock_http_error
335334
336335 exists = helpers .check_pypi_exists (dependency )
@@ -343,8 +342,8 @@ def test_one_doesnt_exists(self):
343342
344343 with patch ('urllib.request.urlopen' ) as mock_urlopen :
345344 with patch ('http.client.HTTPResponse' ) as mock_http_response :
346- mock_http_error = HTTPError ("url" , HTTP_STATUS_NOT_FOUND , "mgs" , {}, io .BytesIO ())
347- mock_http_response .status = HTTP_STATUS_OK
345+ mock_http_error = HTTPError ("url" , HTTPStatus . NOT_FOUND , "mgs" , {}, io .BytesIO ())
346+ mock_http_response .status = HTTPStatus . OK
348347 mock_urlopen .side_effect = [mock_http_response , mock_http_error ]
349348
350349 exists = helpers .check_pypi_exists (dependencies )
0 commit comments