Skip to content

Commit 2fdf480

Browse files
authored
github workflow: give pre-commit its own job (python-telegram-bot#1612)
1 parent 4e717a1 commit 2fdf480

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ jobs:
1616
- os: ubuntu-latest
1717
python-version: 3.7
1818
test-build: True
19-
test-pre-commit: True
2019
- os: windows-latest
2120
python-version: 3.7
2221
test-build: True
@@ -89,4 +88,27 @@ jobs:
8988
env:
9089
TEST_OFFICIAL: "true"
9190
shell: bash --noprofile --norc {0}
92-
91+
test_pre_commit:
92+
name: test-pre-commit
93+
runs-on: ${{matrix.os}}
94+
strategy:
95+
matrix:
96+
python-version: [3.7]
97+
os: [ubuntu-latest]
98+
fail-fast: False
99+
steps:
100+
- uses: actions/checkout@v1
101+
- name: Initialize vendored libs
102+
run:
103+
git submodule update --init --recursive
104+
- name: Set up Python ${{ matrix.python-version }}
105+
uses: actions/setup-python@v1
106+
with:
107+
python-version: ${{ matrix.python-version }}
108+
- name: Install dependencies
109+
run: |
110+
python -W ignore -m pip install --upgrade pip
111+
python -W ignore -m pip install -r requirements.txt
112+
python -W ignore -m pip install -r requirements-dev.txt
113+
- name: Run pre-commit tests
114+
run: pre-commit run --all-files

tests/test_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def test_to_float_timestamp_absolute_aware(self, timezone):
5858
# we're parametrizing this with two different UTC offsets to exclude the possibility
5959
# of an xpass when the test is run in a timezone with the same UTC offset
6060
datetime = dtm.datetime(2019, 11, 11, 0, 26, 16, 10**5, tzinfo=timezone)
61-
assert (helpers.to_float_timestamp(datetime) ==
62-
1573431976.1 - timezone.utcoffset(None).total_seconds())
61+
assert (helpers.to_float_timestamp(datetime)
62+
== 1573431976.1 - timezone.utcoffset(None).total_seconds())
6363

6464
def test_to_float_timestamp_absolute_no_reference(self):
6565
"""A reference timestamp is only relevant for relative time specifications"""
@@ -94,8 +94,8 @@ def test_to_float_timestamp_time_of_day_timezone(self, timezone):
9494
# first test that naive time is assumed to be utc:
9595
assert helpers.to_float_timestamp(time_of_day, ref_t) == pytest.approx(ref_t)
9696
# test that by setting the timezone the timestamp changes accordingly:
97-
assert (helpers.to_float_timestamp(time_of_day.replace(tzinfo=timezone), ref_t) ==
98-
pytest.approx(ref_t + (-utc_offset.total_seconds() % (24 * 60 * 60))))
97+
assert (helpers.to_float_timestamp(time_of_day.replace(tzinfo=timezone), ref_t)
98+
== pytest.approx(ref_t + (-utc_offset.total_seconds() % (24 * 60 * 60))))
9999

100100
@pytest.mark.parametrize('time_spec', RELATIVE_TIME_SPECS, ids=str)
101101
def test_to_float_timestamp_default_reference(self, time_spec):

0 commit comments

Comments
 (0)