Skip to content

Commit

Permalink
chore: format code and remove unused dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
pallabpain committed Dec 4, 2024
1 parent 433c58f commit ae2f54b
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 23 deletions.
82 changes: 80 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,87 @@ dev = [
"pytest-cov>=5.0.0",
"pytest-mock>=3.14.0",
"pytest>=8.3.3",
"anyio>=4.5.2",
"asyncer>=0.0.8",
"typing-extensions>=4.12.2",
"pytest-asyncio>=0.24.0",
"asyncmock>=0.4.2",
]


[tool.ruff]
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
]

# Same as Black.
line-length = 90
indent-width = 4

# Assume Python 3.8
target-version = "py38"

[tool.ruff.lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
# Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
# McCabe complexity (`C901`) by default.
select = ["E4", "E7", "E9", "F", "B", "Q", "W"]
ignore = ["E741", "B904"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[tool.ruff.format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"

# Enable auto-formatting of code examples in docstrings. Markdown,
# reStructuredText code/literal blocks and doctests are all supported.
#
# This is currently disabled by default, but it is planned for this
# to be opt-out in the future.
docstring-code-format = false

# Set the line length limit used when formatting code snippets in
# docstrings.
#
# This only has an effect when the `docstring-code-format` setting is
# enabled.
docstring-code-line-length = "dynamic"
4 changes: 1 addition & 3 deletions tests/async_tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ async def test_create_package_success(client, mocker: AsyncMock): # noqa: F811
json={
"kind": "Package",
"metadata": {"name": "test-package", "guid": "mock_package_guid"},
"spec": {
"users": [{"userGUID": "mock_user_guid", "emailID": "mock_email"}]
},
"spec": {"users": [{"userGUID": "mock_user_guid", "emailID": "mock_email"}]},
},
)

Expand Down
4 changes: 1 addition & 3 deletions tests/sync_tests/test_configtree.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,7 @@ def test_update_configtree_success(client, mocker: MockerFixture): # noqa: F811
}

# Call the update_configtree method
response = client.update_configtree(
name="mock_configtree_name", body=configtree_body
)
response = client.update_configtree(name="mock_configtree_name", body=configtree_body)

# Validate the response
assert isinstance(response, Munch)
Expand Down
4 changes: 1 addition & 3 deletions tests/sync_tests/test_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,7 @@ def test_update_deployment_success(client, deployment_body, mocker: MockerFixtur
if v is not None
}

response = client.update_deployment(
name="mock_deployment_name", body=deployment_body
)
response = client.update_deployment(name="mock_deployment_name", body=deployment_body)

assert isinstance(response, Munch)
assert response["metadata"]["guid"] == "test_deployment_guid"
Expand Down
8 changes: 2 additions & 6 deletions tests/sync_tests/test_managedservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ def test_list_providers_success(client, mocker: MockerFixture): # noqa: F811

# Validate the response
assert isinstance(response, Munch)
assert response["items"] == [
{"name": "test-provider", "guid": "mock_provider_guid"}
]
assert response["items"] == [{"name": "test-provider", "guid": "mock_provider_guid"}]


def test_list_instances_success(client, mocker: MockerFixture): # noqa: F811
Expand Down Expand Up @@ -69,9 +67,7 @@ def test_list_instances_success(client, mocker: MockerFixture): # noqa: F811

# Validate the response
assert isinstance(response, Munch)
assert response["items"] == [
{"name": "test-instance", "guid": "mock_instance_guid"}
]
assert response["items"] == [{"name": "test-instance", "guid": "mock_instance_guid"}]


def test_get_instance_success(client, mocker: MockerFixture): # noqa: F811
Expand Down
4 changes: 1 addition & 3 deletions tests/sync_tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,7 @@ def test_update_project_success(client, mock_response_project, mocker: MockerFix
}

# Call the update_project method
response = client.update_project(
project_guid="mock_project_guid", body=project_body
)
response = client.update_project(project_guid="mock_project_guid", body=project_body)

# Validate the response
assert isinstance(response, Munch)
Expand Down
4 changes: 1 addition & 3 deletions tests/utils/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ def mock_response_project():
"kind": "Project",
"metadata": {"name": "test-project", "guid": "mock_project_guid"},
"spec": {
"users": [
{"userGUID": "mock_user_guid", "emailID": "[email protected]"}
]
"users": [{"userGUID": "mock_user_guid", "emailID": "[email protected]"}]
},
}

Expand Down

0 comments on commit ae2f54b

Please sign in to comment.