Zac-HD / stdlib-property-tests

Property-based tests for the Python standard library (and builtins)
27 stars 6 forks source link

Comparison-test C and Python versions of various modules #2

Open pganssle opened 4 years ago

pganssle commented 4 years ago

The datetime module has an implementation both in C and in Python, and PEP 399 says that the tests must pass for both versions.

In CPython, some tricksy import magic is done to run the tests with and without the C extension. I don't really love it and I think it might actually be a bit fragile. We can always copy that solution, but I'm opening this ticket to brainstorm or just to put "we should consider other ways to accomplish this" on the to-do list.

pschanely commented 4 years ago

I cannot say how happy I am that you pointed this out to me. Datetime support is in the works!

Zac-HD commented 4 years ago

@pganssle points out here that

If test.support.import_fresh_module were less touchy, I'd be all over this for datetime, and this whole class of tests is super useful for anything with both a C and Python implementation, for PEP 399 compliance. That includes, I believe, heapq, jsonand warnings, plus any new modules that have a C extension.

So fixing that and then writing the relevant tests seems like a useful thing to have on an issue tracker :wink: