diff --git a/src/http_cli/__init__.py b/PyFetch/__init__.py similarity index 52% rename from src/http_cli/__init__.py rename to PyFetch/__init__.py index d0ef5a1..a32c66c 100644 --- a/src/http_cli/__init__.py +++ b/PyFetch/__init__.py @@ -1,6 +1,6 @@ """HTTP CLI client library for making HTTP requests.""" -from http_cli.exceptions import HTTPClientError, HTTPConnectionError, ResponseError -from http_cli.http_client import HTTPClient +from PyFetch.exceptions import HTTPClientError, HTTPConnectionError, ResponseError +from PyFetch.http_client import HTTPClient __all__ = ["HTTPClient", "HTTPClientError", "HTTPConnectionError", "ResponseError"] diff --git a/src/http_cli/__main__.py b/PyFetch/__main__.py similarity index 87% rename from src/http_cli/__main__.py rename to PyFetch/__main__.py index b9578ca..b68fccf 100644 --- a/src/http_cli/__main__.py +++ b/PyFetch/__main__.py @@ -2,7 +2,7 @@ import sys -from http_cli.cli import main +from PyFetch.cli import main if __name__ == "__main__": try: diff --git a/src/http_cli/cli.py b/PyFetch/cli.py similarity index 98% rename from src/http_cli/cli.py rename to PyFetch/cli.py index 92e24cf..6cc7b03 100644 --- a/src/http_cli/cli.py +++ b/PyFetch/cli.py @@ -5,8 +5,8 @@ import sys import textwrap -from http_cli.exceptions import HTTPClientError -from http_cli.http_client import HTTPClient +from PyFetch.exceptions import HTTPClientError +from PyFetch.http_client import HTTPClient def show_examples(suppress_output=False): diff --git a/src/http_cli/exceptions.py b/PyFetch/exceptions.py similarity index 100% rename from src/http_cli/exceptions.py rename to PyFetch/exceptions.py diff --git a/src/http_cli/http_client.py b/PyFetch/http_client.py similarity index 97% rename from src/http_cli/http_client.py rename to PyFetch/http_client.py index 1da3476..db4ad9c 100644 --- a/src/http_cli/http_client.py +++ b/PyFetch/http_client.py @@ -2,7 +2,7 @@ import requests -from http_cli.exceptions import HTTPClientError, HTTPConnectionError, ResponseError +from PyFetch.exceptions import HTTPClientError, HTTPConnectionError, ResponseError class HTTPClient: diff --git a/setup.py b/setup.py index c89340e..01545ef 100644 --- a/setup.py +++ b/setup.py @@ -5,14 +5,14 @@ setup( name="PyFetch", version="1.0.0", - packages=find_packages(where="src"), - package_dir={"": "src"}, + packages=find_packages(include=["PyFetch", "PyFetch.*"]), # updated packages lookup + package_dir={"PyFetch": "PyFetch"}, # updated package directory mapping install_requires=[ "requests>=2.25.1", ], entry_points={ "console_scripts": [ - "pyfetch=http_cli.cli:main", + "pyfetch=PyFetch.cli:main", ], }, author="Malte Mindedal", diff --git a/tests/test_cli.py b/tests/test_cli.py index 1fc26b7..6213d79 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -4,7 +4,7 @@ import unittest from unittest.mock import patch -from http_cli.cli import main, show_examples +from PyFetch.cli import main, show_examples class TestCLI(unittest.TestCase): @@ -23,8 +23,8 @@ def test_help_command(self): main(suppress_output=True) self.assertEqual("", fake_stdout.getvalue()) + @patch("PyFetch.http_client.HTTPClient.get") @patch("sys.argv", ["http_cli", "GET", "https://api.example.com"]) - @patch("http_cli.http_client.HTTPClient.get") def test_get_command(self, mock_get): """Test the GET command""" mock_get.return_value.status_code = 200 @@ -34,11 +34,11 @@ def test_get_command(self, mock_get): main() mocked_print.assert_called_with("Success") + @patch("PyFetch.http_client.HTTPClient.post") @patch( "sys.argv", ["http_cli", "POST", "https://api.example.com", "-d", '{"key": "value"}'], ) - @patch("http_cli.http_client.HTTPClient.post") def test_post_command(self, mock_post): """Test the POST command""" mock_post.return_value.status_code = 201 diff --git a/tests/test_exceptions.py b/tests/test_exceptions.py index 44ddb35..4eacfb8 100644 --- a/tests/test_exceptions.py +++ b/tests/test_exceptions.py @@ -2,7 +2,7 @@ import unittest -from http_cli.exceptions import HTTPClientError +from PyFetch.exceptions import HTTPClientError class TestHTTPClientError(unittest.TestCase): diff --git a/tests/test_http_client.py b/tests/test_http_client.py index ce1dbda..0bf8ffa 100644 --- a/tests/test_http_client.py +++ b/tests/test_http_client.py @@ -3,8 +3,8 @@ import unittest from unittest.mock import patch -from http_cli.exceptions import HTTPClientError -from http_cli.http_client import HTTPClient +from PyFetch.exceptions import HTTPClientError +from PyFetch.http_client import HTTPClient class TestHTTPClient(unittest.TestCase):