-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* project metadata updates * Refactored Mechanism for Handling Exceptions Raised (#14) * Setup pre-commit hooks * Updated path for ruff formatter * initial readme commit - needs updating * Updated return object for sendRequests; support for return_exceptions * initial test setup * Added tests that interact with test server * Implemented PUT, PATCH, OPTIONS, DELETE; updated return type to dataclass * isort formatting * GitHub Actions + Ruff config * initial commit of workflow * Updated import path * Updated braches config * Updated RUFF linter config and added to GitHub Actions workflow * Updated ignore config for Ruff * Updated type annotations * Test code formatting fixes * Added badges to README * Renamed workflow to CI * Documentation for Installation and Example Usage in README (#5) * Created 'Installing' and 'Usage' sections in README * Added example in 'Usage' section * Added 'Parsing Results' subsection * Removed 'Parsing Results' subsection and added to 'Example' code block * Setup PyPI Publishing from GitHub Actions Workflow (#4) * Added release workflow to publish to pypi * Updated version to 0.0.2 * Updated release workflow to only be triggered by pushed to main * Fixed typo * Renamed RequestResponse.responseBody -> RequestResponse.body * uvloop is optional; defaults to asyncio (#9) * Updated README and reset version to 0.0.1 * Increased version to 0.0.2.alpha * Updated workflow to be triggered by releases * Removed RequestResults * Removed RequestResults * Added test server written in python + additional tests * Removed references to RequestResults * Commenting tests until GitHub actions integration completed
- Loading branch information
Showing
7 changed files
with
1,014 additions
and
583 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
[tool.poetry] | ||
name = "loamy" | ||
version = "0.0.2.alpha" | ||
version = "0.0.2" | ||
description = "" | ||
authors = ["Zach Fuller <[email protected]>"] | ||
readme = "README.md" | ||
license = "MIT" | ||
repository = "https://github.com/fullerzz/zConcurrent" | ||
repository = "https://github.com/fullerzz/loamy" | ||
packages = [{include = "loamy", from = "src"}] | ||
|
||
[tool.poetry.dependencies] | ||
|
@@ -20,6 +20,9 @@ ruff = "~0.1.4" | |
pre-commit = "3.5.0" | ||
pytest = "^7.4.3" | ||
pytest-asyncio = "^0.21.1" | ||
blacksheep = "^2.0.1" | ||
uvicorn = "^0.24.0.post1" | ||
mypy = "^1.7.1" | ||
|
||
[tool.poetry.extras] | ||
uvloop = ["uvloop"] | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from blacksheep import Application, Request, Response, get, json, post | ||
|
||
app = Application() | ||
|
||
|
||
@get("/") | ||
async def index() -> Response: | ||
return json({"message": "Hello, world!"}) | ||
|
||
|
||
@post("/foo") | ||
async def post_foo(request: Request) -> Response: | ||
data = await request.json() | ||
return json(data) | ||
|
||
|
||
@get("/exception") | ||
async def mock_exception(): | ||
raise Exception("Mock exception") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# import pytest | ||
# from src.loamy.session import Clump, RequestMap, RequestResponse | ||
|
||
|
||
# @pytest.fixture(scope="session") | ||
# def request_map_collection() -> list[RequestMap]: | ||
# requests: list[RequestMap] = [] | ||
# for i in range(0, 100): | ||
# print(i) | ||
# if i % 2 == 0: | ||
# requests.append( | ||
# RequestMap( | ||
# url="http://localhost:44777/", | ||
# httpOperation="GET", | ||
# ) | ||
# ) | ||
# else: | ||
# requests.append( | ||
# RequestMap( | ||
# url="http://localhost:44777/foo", | ||
# httpOperation="POST", | ||
# body={"foo": "bar"}, | ||
# ) | ||
# ) | ||
# return requests | ||
|
||
|
||
# @pytest.fixture(scope="session") | ||
# def request_map_to_trigger_exception() -> RequestMap: | ||
# return RequestMap( | ||
# url="http://localhost:44777/exception", | ||
# httpOperation="GET", | ||
# ) | ||
|
||
|
||
# def test_send_requests(request_map_collection: list[RequestMap]) -> None: | ||
# session = Clump(requests=request_map_collection) | ||
# responses: list[RequestResponse] = session.sendRequests() | ||
# assert len(responses) == 100 | ||
# for response in responses: | ||
# assert response.statusCode == 200 | ||
# assert response.error is None | ||
|
||
|
||
# def test_send_requests_with_exceptions( | ||
# request_map_collection: list[RequestMap], | ||
# request_map_to_trigger_exception: RequestMap, | ||
# ) -> None: | ||
# requests: list[RequestMap] = request_map_collection.copy() | ||
# requests.append(request_map_to_trigger_exception) | ||
# session = Clump(requests=requests) | ||
# responses: list[RequestResponse] = session.sendRequests(return_exceptions=True) | ||
# assert len(responses) == 101 | ||
# for response in responses: | ||
# if response.requestMap.url == "http://localhost:44777/exception": | ||
# assert response.statusCode == 0 | ||
# assert response.error is not None | ||
# else: | ||
# assert response.statusCode == 200 | ||
# assert response.error is None |