@@ -630,7 +630,9 @@ def wrapper(*args, **kw):
630
630
HOSTv6 = "::1"
631
631
632
632
633
- def find_unused_port (family = socket .AF_INET , socktype = socket .SOCK_STREAM ):
633
+ # TODO: revert me once socket is implemented (GR-9140)
634
+ # def find_unused_port(family=socket.AF_INET, socktype=socket.SOCK_STREAM):
635
+ def find_unused_port (family , socktype ):
634
636
"""Returns an unused port that should be suitable for binding. This is
635
637
achieved by creating a temporary socket with the same family and type as
636
638
the 'sock' parameter (default is AF_INET, SOCK_STREAM), and binding it to
@@ -729,22 +731,33 @@ def bind_port(sock, host=HOST):
729
731
port = sock .getsockname ()[1 ]
730
732
return port
731
733
732
- def _is_ipv6_enabled ():
733
- """Check whether IPv6 is enabled on this host."""
734
- if socket .has_ipv6 :
735
- sock = None
736
- try :
737
- sock = socket .socket (socket .AF_INET6 , socket .SOCK_STREAM )
738
- sock .bind ((HOSTv6 , 0 ))
739
- return True
740
- except OSError :
741
- pass
742
- finally :
743
- if sock :
744
- sock .close ()
745
- return False
746
-
747
- IPV6_ENABLED = _is_ipv6_enabled ()
734
+ def bind_unix_socket (sock , addr ):
735
+ """Bind a unix socket, raising SkipTest if PermissionError is raised."""
736
+ assert sock .family == socket .AF_UNIX
737
+ try :
738
+ sock .bind (addr )
739
+ except PermissionError :
740
+ sock .close ()
741
+ raise unittest .SkipTest ('cannot bind AF_UNIX sockets' )
742
+
743
+ # TODO: reenable me once socket is implemented (GR-9140)
744
+ # def _is_ipv6_enabled():
745
+ # """Check whether IPv6 is enabled on this host."""
746
+ # if socket.has_ipv6:
747
+ # sock = None
748
+ # try:
749
+ # sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
750
+ # sock.bind((HOSTv6, 0))
751
+ # return True
752
+ # except OSError:
753
+ # pass
754
+ # finally:
755
+ # if sock:
756
+ # sock.close()
757
+ # return False
758
+ #
759
+ # IPV6_ENABLED = _is_ipv6_enabled()
760
+ IPV6_ENABLED = False
748
761
749
762
def system_must_validate_cert (f ):
750
763
"""Skip the test on TLS certificate validation failures."""
@@ -788,6 +801,17 @@ def dec(*args, **kwargs):
788
801
789
802
is_jython = sys .platform .startswith ('java' )
790
803
804
+ # TODO: reenable me once sysconfig is properly implemented (GR-9150)
805
+ # _ANDROID_API_LEVEL = sysconfig.get_config_var('ANDROID_API_LEVEL')
806
+ # is_android = (_ANDROID_API_LEVEL is not None and _ANDROID_API_LEVEL > 0)
807
+ is_android = False
808
+ android_not_root = (is_android and os .geteuid () != 0 )
809
+
810
+ if sys .platform != 'win32' :
811
+ unix_shell = '/system/bin/sh' if is_android else '/bin/sh'
812
+ else :
813
+ unix_shell = None
814
+
791
815
# Filename used for testing
792
816
if os .name == 'java' :
793
817
# Jython disallows @ in module names
@@ -1924,9 +1948,12 @@ def case_pred(test):
1924
1948
def _check_docstrings ():
1925
1949
"""Just used to check if docstrings are enabled"""
1926
1950
1927
- MISSING_C_DOCSTRINGS = (check_impl_detail () and
1928
- sys .platform != 'win32' and
1929
- not sysconfig .get_config_var ('WITH_DOC_STRINGS' ))
1951
+
1952
+ #TODO reenable me once platform and sysconfig are implemented/supported
1953
+ # MISSING_C_DOCSTRINGS = (check_impl_detail() and
1954
+ # sys.platform != 'win32' and
1955
+ # not sysconfig.get_config_var('WITH_DOC_STRINGS'))
1956
+ MISSING_C_DOCSTRINGS = False
1930
1957
1931
1958
HAVE_DOCSTRINGS = (_check_docstrings .__doc__ is not None and
1932
1959
not MISSING_C_DOCSTRINGS )
@@ -2264,7 +2291,7 @@ def can_xattr():
2264
2291
os .setxattr (fp .fileno (), b"user.test" , b"" )
2265
2292
# Kernels < 2.6.39 don't respect setxattr flags.
2266
2293
kernel_version = platform .release ()
2267
- m = re .match ("2.6.(\d{1,2})" , kernel_version )
2294
+ m = re .match (r "2.6.(\d{1,2})" , kernel_version )
2268
2295
can = m is None or int (m .group (1 )) >= 39
2269
2296
except OSError :
2270
2297
can = False
0 commit comments