Skip to content

Commit

Permalink
Merge pull request #16 from Point72/tkp/standards
Browse files Browse the repository at this point in the history
update standards in pyprojecttoml for linting and test running
  • Loading branch information
timkpaine authored Oct 24, 2024
2 parents b65d85f + 76bfe43 commit 539c7d6
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ install: ## install to site-packages
.PHONY: test tests

test: ## run the python unit tests
python -m pytest -v csp_adapter_symphony/tests --junitxml=junit.xml --cov=csp_adapter_symphony --cov-report=xml:.coverage.xml --cov-branch --cov-fail-under=75 --cov-report term-missing
python -m pytest -v csp_adapter_symphony/tests --cov=csp_adapter_symphony --cov-report xml --cov-report term-missing

test: tests

Expand Down
9 changes: 5 additions & 4 deletions csp_adapter_symphony/adapter.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import csp
import json
import logging
import requests
import threading
from queue import Queue
from typing import Dict, List, Optional, Tuple

import csp
import requests
from csp import ts
from csp.impl.enum import Enum
from csp.impl.pushadapter import PushInputAdapter
from csp.impl.wiring import py_push_adapter_def
from queue import Queue
from typing import Dict, List, Optional, Tuple

from .adapter_config import SymphonyAdapterConfig, SymphonyRoomMapper

Expand Down
7 changes: 4 additions & 3 deletions csp_adapter_symphony/adapter_config.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import http.client
import json
import logging
import requests
import ssl
import threading
import tenacity
from datetime import timedelta
from functools import cached_property
from pydantic import BaseModel, computed_field, Field, field_validator, FilePath
from tempfile import NamedTemporaryFile
from typing import Callable, Dict, List, Optional, Union

import requests
import tenacity
from pydantic import BaseModel, Field, FilePath, computed_field, field_validator

__all__ = ("SymphonyAdapterConfig", "SymphonyRoomMapper")

log = logging.getLogger(__file__)
Expand Down
6 changes: 3 additions & 3 deletions csp_adapter_symphony/tests/test_adapter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from time import sleep
from unittest.mock import MagicMock, call, patch

import csp
import pytest
from csp import ts
from time import sleep
from unittest.mock import MagicMock, call, patch

from csp_adapter_symphony import (
SymphonyAdapter,
Expand All @@ -14,7 +15,6 @@
from csp_adapter_symphony.adapter import _handle_event
from csp_adapter_symphony.adapter_config import SymphonyAdapterConfig, SymphonyRoomMapper


SAMPLE_EVENTS = [
{
"type": "MESSAGESENT",
Expand Down
30 changes: 24 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ dependencies = [
develop = [
"bump-my-version",
"check-manifest",
"codespell>=2.2.6,<2.3",
"codespell>=2.3,<2.4",
"hatchling",
"mdformat>=0.7.17,<0.8",
"ruff>=0.5,<0.6",
"twine>=5,<5.2",
"mdformat>=0.7.18,<0.8",
"ruff>=0.6,<0.7",
"twine>=5,<6",
# test
"pytest",
"pytest-cov",
Expand Down Expand Up @@ -80,6 +80,19 @@ replace = 'version = "{new_version}"'
[tool.check-manifest]
ignore = []

[tool.coverage.run]
branch = true
omit = []

[tool.coverage.report]
exclude_also = [
"raise NotImplementedError",
"if __name__ == .__main__.:",
"@(abc\\.)?abstractmethod",
]
ignore_errors = true
fail_under = 75

[tool.hatch.build]
artifacts = []

Expand Down Expand Up @@ -110,22 +123,27 @@ exclude = [
]

[tool.pytest.ini_options]
addopts = ["-vvv", "--junitxml=junit.xml"]
asyncio_mode = "strict"
testpaths = "csp_adapter_symphony/tests"

[tool.ruff]
line-length = 150

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]
[tool.ruff.lint]
extend-select = ["I"]

[tool.ruff.lint.isort]
combine-as-imports = true
default-section = "third-party"
known-first-party = ["csp_adapter_symphony"]
section-order = [
"future",
"standard-library",
"third-party",
"first-party",
"local-folder",
]

[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]

0 comments on commit 539c7d6

Please sign in to comment.