File tree 2 files changed +13
-8
lines changed
2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 6
6
import contextlib
7
7
import dataclasses
8
8
import functools
9
- import getpass
10
9
import _opcode
11
10
import os
12
11
import re
@@ -383,6 +382,7 @@ def wrapper(*args, **kw):
383
382
384
383
def skip_if_buildbot (reason = None ):
385
384
"""Decorator raising SkipTest if running on a buildbot."""
385
+ import getpass
386
386
if not reason :
387
387
reason = 'not suitable for buildbots'
388
388
try :
Original file line number Diff line number Diff line change 10
10
import unittest
11
11
import warnings
12
12
13
+ from test import support
14
+
13
15
14
16
# Filename used for testing
15
17
TESTFN_ASCII = '@test'
@@ -720,13 +722,16 @@ def __exit__(self, *ignore_exc):
720
722
721
723
722
724
try :
723
- import ctypes
724
- kernel32 = ctypes .WinDLL ('kernel32' , use_last_error = True )
725
-
726
- ERROR_FILE_NOT_FOUND = 2
727
- DDD_REMOVE_DEFINITION = 2
728
- DDD_EXACT_MATCH_ON_REMOVE = 4
729
- DDD_NO_BROADCAST_SYSTEM = 8
725
+ if support .MS_WINDOWS :
726
+ import ctypes
727
+ kernel32 = ctypes .WinDLL ('kernel32' , use_last_error = True )
728
+
729
+ ERROR_FILE_NOT_FOUND = 2
730
+ DDD_REMOVE_DEFINITION = 2
731
+ DDD_EXACT_MATCH_ON_REMOVE = 4
732
+ DDD_NO_BROADCAST_SYSTEM = 8
733
+ else :
734
+ raise AttributeError
730
735
except (ImportError , AttributeError ):
731
736
def subst_drive (path ):
732
737
raise unittest .SkipTest ('ctypes or kernel32 is not available' )
You can’t perform that action at this time.
0 commit comments