From a7aea5d942f8beb3415df411b73eaf8a8e4321c7 Mon Sep 17 00:00:00 2001 From: Luka Kroeger Date: Sun, 24 Oct 2021 15:13:40 +0200 Subject: [PATCH] Update .pre-commit-config.yaml --- .pre-commit-config.yaml | 25 +++++++++--- .../config.default.yml => config.default.yml | 0 requirements-dev.txt | 7 ++++ tests/unit/test_utils.py | 38 ++++--------------- 4 files changed, 35 insertions(+), 35 deletions(-) rename notion_gcal_sync/config.default.yml => config.default.yml (100%) create mode 100644 requirements-dev.txt diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b31004..2e53480 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,13 +11,28 @@ repos: - id: mixed-line-ending - id: check-toml - id: check-merge-conflict + - repo: https://github.com/PyCQA/flake8 rev: 4.0.1 hooks: - id: flake8 additional_dependencies: [ flake8-typing-imports==1.7.0 ] - - repo: https://github.com/ambv/black - rev: 21.9b0 - hooks: - - id: black - language_version: python3.9 + + - repo: local + hooks: + - id: black + name: black + language: system + entry: black + minimum_pre_commit_version: 2.9.2 + require_serial: true + types_or: [python, pyi] + + - id: pytest + name: pytest + stages: [commit] + language: system + entry: poetry run pytest -s -v . + types: [python] + pass_filenames: false + always_run: true diff --git a/notion_gcal_sync/config.default.yml b/config.default.yml similarity index 100% rename from notion_gcal_sync/config.default.yml rename to config.default.yml diff --git a/requirements-dev.txt b/requirements-dev.txt new file mode 100644 index 0000000..40fca0d --- /dev/null +++ b/requirements-dev.txt @@ -0,0 +1,7 @@ +pytest == "6.2.4" +pytest - cov == "3.0.0" +flake8 == "4.0.1" +poetry == "^1.1.11" +poetry2setup == "^1.0.0" +pre - commit == "^2.15.0" +python - semantic - release == "^7.19.2" diff --git a/tests/unit/test_utils.py b/tests/unit/test_utils.py index 3d87d78..e4457c5 100644 --- a/tests/unit/test_utils.py +++ b/tests/unit/test_utils.py @@ -12,10 +12,7 @@ ("2017-10-25T19:00:00.000+02:00", False), ("2017-10-25T19:00:00.000", False), ("2017-10-25", True), - ( - datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))), - False, - ), + (datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))), False,), (None, None), ], ) @@ -26,10 +23,7 @@ def test_is_date(test_input, expected): @pytest.mark.parametrize( "test_input, expected", [ - ( - datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))), - "2017-10-25T13:37:10+02:00", - ), + (datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))), "2017-10-25T13:37:10+02:00",), (None, None), ], ) @@ -41,10 +35,7 @@ def test_datetime_to_str(test_input, expected): "test_input, expected", [ (datetime(2017, 10, 25), "2017-10-25"), - ( - datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))), - "2017-10-25", - ), + (datetime(2017, 10, 25, 13, 37, 10, 11, tzinfo=timezone(timedelta(seconds=7200))), "2017-10-25",), (None, None), ], ) @@ -74,22 +65,10 @@ def time(): [ (None, None), ("2017-10-25", datetime(2017, 10, 25)), - ( - "2017-10-25T00:00", - datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))), - ), - ( - "2017-10-25T10:10", - datetime(2017, 10, 25, 10, 10, tzinfo=timezone(timedelta(seconds=7200))), - ), - ( - "2017-10-25T10:10+01:00", - datetime(2017, 10, 25, 11, 10, tzinfo=timezone(timedelta(seconds=7200))), - ), - ( - "2017-10-25T10:10+03:00", - datetime(2017, 10, 25, 9, 10, tzinfo=timezone(timedelta(seconds=7200))), - ), + ("2017-10-25T00:00", datetime(2017, 10, 25, 00, 00, tzinfo=timezone(timedelta(seconds=7200))),), + ("2017-10-25T10:10", datetime(2017, 10, 25, 10, 10, tzinfo=timezone(timedelta(seconds=7200))),), + ("2017-10-25T10:10+01:00", datetime(2017, 10, 25, 11, 10, tzinfo=timezone(timedelta(seconds=7200))),), + ("2017-10-25T10:10+03:00", datetime(2017, 10, 25, 9, 10, tzinfo=timezone(timedelta(seconds=7200))),), ], ) def test_str_to_datetime(time_fixture, test_input, expected): @@ -102,8 +81,7 @@ def test_utc_str_to_datetime(): @pytest.mark.parametrize( - "test_input, expected", - [(datetime(2017, 10, 25), datetime(2017, 10, 25)), (None, None)], + "test_input, expected", [(datetime(2017, 10, 25), datetime(2017, 10, 25)), (None, None)], ) def test_to_datetime(time_fixture, test_input, expected): assert time_fixture.to_datetime(test_input) == expected