This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients Michael.Felt, steve.dower, vstinner
Date 2019-04-25.07:31:04
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <96d01230-26d8-e5cc-3b2d-e64ce8d2ba93@felt.demon.nl>
In-reply-to <1556034812.27.0.620139702453.issue36624@roundup.psfhosted.org>
Content
On 23/04/2019 17:53, Steve Dower wrote:
> Steve Dower <steve.dower@python.org> added the comment:
>
>> Being 'runtime' rather than 'buildtime' seemed more precise - tests that
>> are not meant to be build-time dependent use run-time status while
>> leaving sys.platform for concerns that are directly related to builds
> This is a good point - perhaps we need both?
>
> Many of the current test skips are related to build-time switches, but indeed, some relate to the runtime environment.
>
> One aspect I'm keeping in mind here is that with the Windows Subsystem for Linux, many lines are becoming blurred with respect to which build of Python people are using (I'm already getting bug reports from people who thought they were getting the Windows build but actually the Linux one, or vice versa). And mismatching builds causes some weird problems. Being able to clearly identify "Windows build + WSL environment" or "Linux build + WSL environment" will likely matter more over time.
>
> It would be nice to have all the checks centralized, perhaps a set of decorators in a test.requires module?
>
> @test.requires.linux_platform
> @test.requires.darwin_platform
> @test.requires.macos_runtime(10, 9)
> def test_my_test(self): ...
>
> (It would require some clever decorator design, but we can make those work like "ORs" rather than "ANDs".)
>
> Does it provide any benefit? I think it's clever,
Too clever for me to build. There is a lot about the Python language
(syntax) I do not understand well enough.
> but that doesn't mean it's worthwhile :) Using skipIf and skipUnless with test.support.CONSTANTS is just as readable and just as obvious (once we're using them consistently).

To that end, I modified another 60 lines, or so, of mainly sys.platform
== 'win32' to use MS_WINDOWS, not MS_WINDOWS, skipIf(MS_WINDOWS,...) or
SkipUnless(MS_WINDOWS,...) - or comparable for the other platforms.

I also replaced the use of (support.)is_android and (support.is_java)
with ANDROID and JYTHON.

Curious about comments from code owners. And suggestions re: the
sys.platform lines (roughly 50) that are left.

FYI: when I started there were 321 references to sys.platform with
roughly 315 involved in a string comparison of some kind. Now it is
closer to 50.

>
> <End brainstorming>
>
> ----------
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue36624>
> _______________________________________
>
History
Date User Action Args
2019-04-25 07:31:05Michael.Feltsetrecipients: + Michael.Felt, vstinner, steve.dower
2019-04-25 07:31:05Michael.Feltlinkissue36624 messages
2019-04-25 07:31:04Michael.Feltcreate