Skip to content

Commit

Permalink
Mark failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowone committed May 10, 2024
1 parent 898a6d2 commit 0fda0c3
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 5 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ env:
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,ssl
# Skip additional tests on Windows. They are checked on Linux and MacOS.
WINDOWS_SKIPS: >-
test_datetime
test_glob
test_importlib
test_io
Expand Down
30 changes: 30 additions & 0 deletions Lib/test/datetimetester.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def test_normal(self):
self.assertEqual(fo.tzname(dt), "Three")
self.assertEqual(fo.dst(dt), timedelta(minutes=42))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pickling_base(self):
# There's no point to pickling tzinfo objects on their own (they
# carry no data), but they need to be picklable anyway else
Expand All @@ -207,6 +209,8 @@ def test_pickling_base(self):
derived = unpickler.loads(green)
self.assertIs(type(derived), tzinfo)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pickling_subclass(self):
# Make sure we can pickle/unpickle an instance of a subclass.
offset = timedelta(minutes=-300)
Expand Down Expand Up @@ -385,6 +389,8 @@ def test_aware_datetime(self):
self.assertEqual(tz.dst(t),
t.replace(tzinfo=tz).dst())

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pickle(self):
for tz in self.ACDT, self.EST, timezone.min, timezone.max:
for pickler, unpickler, proto in pickle_choices:
Expand All @@ -395,6 +401,8 @@ def test_pickle(self):
tz_copy = unpickler.loads(pickler.dumps(tz, proto))
self.assertIs(tz_copy, tz)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_copy(self):
for tz in self.ACDT, self.EST, timezone.min, timezone.max:
tz_copy = copy.copy(tz)
Expand All @@ -403,6 +411,8 @@ def test_copy(self):
tz_copy = copy.copy(tz)
self.assertIs(tz_copy, tz)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_deepcopy(self):
for tz in self.ACDT, self.EST, timezone.min, timezone.max:
tz_copy = copy.deepcopy(tz)
Expand Down Expand Up @@ -1498,6 +1508,8 @@ def test_strftime(self):
# bpo-41260: The parameter was named "fmt" in the pure python impl.
t.strftime(format="%f")

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_strftime_trailing_percent(self):
# bpo-35066: Make sure trailing '%' doesn't cause datetime's strftime to
# complain. Different libcs have different handling of trailing
Expand Down Expand Up @@ -1598,6 +1610,8 @@ def test_pickling(self):
self.assertEqual(orig, derived)
self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_compat_unpickle(self):
tests = [
b"cdatetime\ndate\n(S'\\x07\\xdf\\x0b\\x1b'\ntR.",
Expand Down Expand Up @@ -2365,6 +2379,8 @@ def test_pickling_subclass_datetime(self):
self.assertEqual(orig, derived)
self.assertTrue(isinstance(derived, SubclassDatetime))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_compat_unpickle(self):
tests = [
b'cdatetime\ndatetime\n('
Expand Down Expand Up @@ -2937,6 +2953,8 @@ def newmeth(self, start):
self.assertEqual(dt2.newmeth(-7), dt1.year + dt1.month +
dt1.second - 7)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_subclass_alternate_constructors_datetime(self):
# Test that alternate constructors call the constructor
class DateTimeSubclass(self.theclass):
Expand Down Expand Up @@ -3635,6 +3653,8 @@ def test_pickling_subclass_time(self):
self.assertEqual(orig, derived)
self.assertTrue(isinstance(derived, SubclassTime))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_compat_unpickle(self):
tests = [
(b"cdatetime\ntime\n(S'\\x14;\\x10\\x00\\x10\\x00'\ntR.",
Expand Down Expand Up @@ -4007,6 +4027,8 @@ def test_hash_edge_cases(self):
t2 = self.theclass(23, 48, 6, 100, tzinfo=FixedOffset(-1010, ""))
self.assertEqual(hash(t1), hash(t2))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pickling(self):
# Try one without a tzinfo.
args = 20, 59, 16, 64**2
Expand All @@ -4029,6 +4051,8 @@ def test_pickling(self):
self.assertEqual(derived.tzname(), 'cookie')
self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_compat_unpickle(self):
tests = [
b"cdatetime\ntime\n(S'\\x05\\x06\\x07\\x01\\xe2@'\n"
Expand Down Expand Up @@ -4458,6 +4482,8 @@ def utcoffset(self, dt):
t2 = self.theclass(2, 2, 2, tzinfo=FixedOffset(0, ""))
self.assertRaises(ValueError, lambda: t1 == t2)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_pickling(self):
# Try one without a tzinfo.
args = 6, 7, 23, 20, 59, 1, 64**2
Expand All @@ -4481,6 +4507,8 @@ def test_pickling(self):
self.assertEqual(derived.tzname(), 'cookie')
self.assertEqual(orig.__reduce__(), orig.__reduce_ex__(2))

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_compat_unpickle(self):
tests = [
b'cdatetime\ndatetime\n'
Expand Down Expand Up @@ -5443,6 +5471,8 @@ def test_bug_1028306(self):
self.assertEqual(as_datetime, datetime_sc)
self.assertEqual(datetime_sc, as_datetime)

# TODO: RUSTPYTHON
@unittest.expectedFailure
def test_extra_attributes(self):
with self.assertWarns(DeprecationWarning):
utcnow = datetime.utcnow()
Expand Down
10 changes: 8 additions & 2 deletions Lib/test/test_datetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,14 @@ def load_tests(loader, tests, pattern):
for modname in ['datetime', '_datetime', '_strptime']:
sys.modules.pop(modname, None)

test_modules = [pure_tests, fast_tests]
test_suffixes = ["_Pure", "_Fast"]
test_modules = [
pure_tests,
# fast_tests # XXX: RUSTPYTHON; not supported yet
]
test_suffixes = [
"_Pure",
# "_Fast" # XXX: RUSTPYTHON; not supported yet
]
# XXX(gb) First run all the _Pure tests, then all the _Fast tests. You might
# not believe this, but in spite of all the sys.modules trickery running a _Pure
# test last will leave a mix of pure and native datetime stuff lying around.
Expand Down
15 changes: 12 additions & 3 deletions vm/src/stdlib/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

// See also:
// https://docs.python.org/3/library/time.html
pub use time::*;
use crate::{builtins::PyModule, VirtualMachine, PyRef};

pub use decl::time;

pub(crate) fn make_module(vm: &VirtualMachine) -> PyRef<PyModule> {
let module = decl::make_module(vm);
#[cfg(not(target_env = "msvc"))]
unsafe { decl::tz::tzset() };
module
}

#[pymodule(name = "time", with(platform))]
mod time {
mod decl {
use crate::{
builtins::{tuple::IntoPyTuple, PyStrRef, PyTupleRef, PyTypeRef},
function::{Either, FuncArgs, OptionalArg},
Expand Down Expand Up @@ -416,7 +425,7 @@ mod time {
#[pymodule(sub)]
mod platform {
#[allow(unused_imports)]
use super::{SEC_TO_NS, US_TO_NS};
use super::decl::{SEC_TO_NS, US_TO_NS};
#[cfg_attr(target_os = "macos", allow(unused_imports))]
use crate::{
builtins::{PyNamespace, PyStrRef},
Expand Down

0 comments on commit 0fda0c3

Please sign in to comment.