mirror of
https://github.com/python-telegram-bot/python-telegram-bot.git
synced 2025-03-13 11:18:20 +01:00
github workflow: give pre-commit its own job (#1612)
This commit is contained in:
parent
4e717a172b
commit
2fdf48023b
2 changed files with 28 additions and 6 deletions
26
.github/workflows/test.yml
vendored
26
.github/workflows/test.yml
vendored
|
@ -16,7 +16,6 @@ jobs:
|
|||
- os: ubuntu-latest
|
||||
python-version: 3.7
|
||||
test-build: True
|
||||
test-pre-commit: True
|
||||
- os: windows-latest
|
||||
python-version: 3.7
|
||||
test-build: True
|
||||
|
@ -89,4 +88,27 @@ jobs:
|
|||
env:
|
||||
TEST_OFFICIAL: "true"
|
||||
shell: bash --noprofile --norc {0}
|
||||
|
||||
test_pre_commit:
|
||||
name: test-pre-commit
|
||||
runs-on: ${{matrix.os}}
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.7]
|
||||
os: [ubuntu-latest]
|
||||
fail-fast: False
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Initialize vendored libs
|
||||
run:
|
||||
git submodule update --init --recursive
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -W ignore -m pip install --upgrade pip
|
||||
python -W ignore -m pip install -r requirements.txt
|
||||
python -W ignore -m pip install -r requirements-dev.txt
|
||||
- name: Run pre-commit tests
|
||||
run: pre-commit run --all-files
|
||||
|
|
|
@ -58,8 +58,8 @@ class TestHelpers(object):
|
|||
# we're parametrizing this with two different UTC offsets to exclude the possibility
|
||||
# of an xpass when the test is run in a timezone with the same UTC offset
|
||||
datetime = dtm.datetime(2019, 11, 11, 0, 26, 16, 10**5, tzinfo=timezone)
|
||||
assert (helpers.to_float_timestamp(datetime) ==
|
||||
1573431976.1 - timezone.utcoffset(None).total_seconds())
|
||||
assert (helpers.to_float_timestamp(datetime)
|
||||
== 1573431976.1 - timezone.utcoffset(None).total_seconds())
|
||||
|
||||
def test_to_float_timestamp_absolute_no_reference(self):
|
||||
"""A reference timestamp is only relevant for relative time specifications"""
|
||||
|
@ -94,8 +94,8 @@ class TestHelpers(object):
|
|||
# first test that naive time is assumed to be utc:
|
||||
assert helpers.to_float_timestamp(time_of_day, ref_t) == pytest.approx(ref_t)
|
||||
# test that by setting the timezone the timestamp changes accordingly:
|
||||
assert (helpers.to_float_timestamp(time_of_day.replace(tzinfo=timezone), ref_t) ==
|
||||
pytest.approx(ref_t + (-utc_offset.total_seconds() % (24 * 60 * 60))))
|
||||
assert (helpers.to_float_timestamp(time_of_day.replace(tzinfo=timezone), ref_t)
|
||||
== pytest.approx(ref_t + (-utc_offset.total_seconds() % (24 * 60 * 60))))
|
||||
|
||||
@pytest.mark.parametrize('time_spec', RELATIVE_TIME_SPECS, ids=str)
|
||||
def test_to_float_timestamp_default_reference(self, time_spec):
|
||||
|
|
Loading…
Add table
Reference in a new issue