Skip to content

Fix failing CI tests on lint #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions tests/test_date.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
# SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
# SPDX-License-Identifier: Python-2.0
# Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py
# NOTE: This test is based off CPython and therefore linting is disabled within this file.
# pylint:disable=invalid-name, no-member, wrong-import-position, undefined-variable, no-self-use, cell-var-from-loop, misplaced-comparison-constant, too-many-public-methods, fixme, import-outside-toplevel, unused-argument, too-few-public-methods
import sys
import unittest

Expand Down
25 changes: 15 additions & 10 deletions tests/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
# SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
# SPDX-License-Identifier: Python-2.0
# Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py
# NOTE: This test is based off CPython and therefore linting is disabled within this file.
# pylint:disable=invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, raise-missing-from, too-many-statements, too-many-lines, undefined-variable, eval-used, import-outside-toplevel, redefined-outer-name, too-many-locals, reimported, protected-access, wrong-import-position, consider-using-enumerate, wrong-import-order, redefined-builtin, too-many-public-methods
import sys
import unittest
from test import support
from test_date import TestDate

# CPython standard implementation
from datetime import datetime as cpython_datetime
from datetime import MINYEAR, MAXYEAR

# CircuitPython subset implementation
sys.path.append("..")
Expand All @@ -26,6 +21,15 @@
from adafruit_datetime import time
from adafruit_datetime import timezone

import unittest
from test import support
from test_date import TestDate

# CPython standard implementation
from datetime import datetime as cpython_datetime
from datetime import MINYEAR, MAXYEAR


# TZinfo test
class FixedOffset(tzinfo):
def __init__(self, offset, name, dstoffset=42):
Expand Down Expand Up @@ -268,7 +272,7 @@ def strftime(self, format_spec):
@unittest.skip("ctime not implemented")
def test_more_ctime(self):
# Test fields that TestDate doesn't touch.
import time
import time as cpython_time

t = self.theclass(2002, 3, 2, 18, 3, 5, 123)
self.assertEqual(t.ctime(), "Sat Mar 2 18:03:05 2002")
Expand All @@ -280,7 +284,9 @@ def test_more_ctime(self):

# So test a case where that difference doesn't matter.
t = self.theclass(2002, 3, 22, 18, 3, 5, 123)
self.assertEqual(t.ctime(), time.ctime(time.mktime(t.timetuple())))
self.assertEqual(
t.ctime(), cpython_time.ctime(cpython_time.mktime(t.timetuple()))
)

def test_tz_independent_comparing(self):
dt1 = self.theclass(2002, 3, 1, 9, 0, 0)
Expand Down Expand Up @@ -537,7 +543,6 @@ def test_timestamp_naive(self):
self.assertEqual(self.theclass.fromtimestamp(t.timestamp()), t)

# Timestamp may raise an overflow error on some platforms
# XXX: Do we care to support the first and last year?
for t in [self.theclass(2, 1, 1), self.theclass(9998, 12, 12)]:
try:
s = t.timestamp()
Expand Down
12 changes: 7 additions & 5 deletions tests/test_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@
# SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
# SPDX-License-Identifier: Python-2.0
# Implements a subset of https://github.com/python/cpython/blob/master/Lib/test/datetimetester.py
import unittest

# CPython standard implementation
from datetime import time as cpython_time

# NOTE: This test is based off CPython and therefore linting is disabled within this file.
# pylint:disable=invalid-name, no-member, cell-var-from-loop, unused-argument, no-self-use, too-few-public-methods, consider-using-enumerate, undefined-variable, wrong-import-order, wrong-import-position
# CircuitPython subset implementation
import sys

sys.path.append("..")
from adafruit_datetime import time as cpy_time

# CPython standard implementation
from datetime import time as cpython_time
import unittest


# An arbitrary collection of objects of non-datetime types, for testing
# mixed-type comparisons.
OTHERSTUFF = (10, 34.5, "abc", {}, [], ())
Expand Down