Skip to content

Commit

Permalink
chore: update pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sauljabin committed Nov 25, 2024
1 parent 9930237 commit c0be474
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
18 changes: 12 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@ repos:
- id: check-added-large-files
- repo: local
hooks:
- id: tests
name: running tests
language: system
always_run: true
pass_filenames: false
entry: poetry run python -m scripts.tests
- id: styles
name: applying styles
language: system
Expand All @@ -26,3 +20,15 @@ repos:
always_run: true
pass_filenames: false
entry: poetry run python -m scripts.analyze
- id: tests
name: running tests
language: system
always_run: true
pass_filenames: false
entry: poetry run python -m scripts.tests
- id: tests-e2e
name: running e2e tests
language: system
always_run: true
pass_filenames: false
entry: poetry run python -m scripts.tests --e2e
3 changes: 1 addition & 2 deletions tests-e2e/tests_e2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@


CURRENT_PATH = os.getcwd()

PROPERTIES_PATH = (
f"{CURRENT_PATH}/../.env" if CURRENT_PATH.endswith("tests") else f"{CURRENT_PATH}/.env"
f"{CURRENT_PATH}/../.env" if CURRENT_PATH.endswith("tests-e2e") else f"{CURRENT_PATH}/.env"
)
SANDBOX_PROPERTIES = load_properties(PROPERTIES_PATH)
CP_VERSION = SANDBOX_PROPERTIES["CP_VERSION"]
Expand Down
22 changes: 8 additions & 14 deletions tests/tests_deserializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@


CURRENT_PATH = os.getcwd()
DESCRIPTOR_NAME = "protobuf/user.desc"
DESCRIPTOR_PATH = (
f"{CURRENT_PATH}/{DESCRIPTOR_NAME}"
if CURRENT_PATH.endswith("tests")
else f"{CURRENT_PATH}/tests/{DESCRIPTOR_NAME}"
)


class TestDeserializer(unittest.TestCase):
Expand Down Expand Up @@ -133,13 +139,7 @@ def test_avro_deserialization_with_magic_byte(self, mock_sr_client_class):
self.assertEqual(expected_value, result)

def test_protobuf_deserialization(self):
descriptor_file_name = "protobuf/user.desc"
descriptor_path = (
f"{CURRENT_PATH}/{descriptor_file_name}"
if CURRENT_PATH.endswith("tests")
else f"{CURRENT_PATH}/tests/{descriptor_file_name}"
)
deserializer = ProtobufDeserializer({"descriptor": descriptor_path, "value": "User"})
deserializer = ProtobufDeserializer({"descriptor": DESCRIPTOR_PATH, "value": "User"})

user = User()
user.name = "my name"
Expand All @@ -148,13 +148,7 @@ def test_protobuf_deserialization(self):
self.assertEqual({"name": user.name}, result)

def test_protobuf_deserialization_with_magic_byte(self):
descriptor_file_name = "protobuf/user.desc"
descriptor_path = (
f"{CURRENT_PATH}/{descriptor_file_name}"
if CURRENT_PATH.endswith("tests")
else f"{CURRENT_PATH}/tests/{descriptor_file_name}"
)
deserializer = ProtobufDeserializer({"descriptor": descriptor_path, "value": "User"})
deserializer = ProtobufDeserializer({"descriptor": DESCRIPTOR_PATH, "value": "User"})

user = User()
user.name = "my name"
Expand Down

0 comments on commit c0be474

Please sign in to comment.