33import os
44import re
55import test .support
6+ from test .support import os_helper
7+ from test .support import warnings_helper
68import time
79import unittest
810import urllib .request
@@ -328,12 +330,12 @@ def _interact(cookiejar, url, set_cookie_hdrs, hdr_name):
328330
329331class FileCookieJarTests (unittest .TestCase ):
330332 def test_constructor_with_str (self ):
331- filename = test . support .TESTFN
333+ filename = os_helper .TESTFN
332334 c = LWPCookieJar (filename )
333335 self .assertEqual (c .filename , filename )
334336
335337 def test_constructor_with_path_like (self ):
336- filename = pathlib .Path (test . support .TESTFN )
338+ filename = pathlib .Path (os_helper .TESTFN )
337339 c = LWPCookieJar (filename )
338340 self .assertEqual (c .filename , os .fspath (filename ))
339341
@@ -353,7 +355,7 @@ class A:
353355
354356 def test_lwp_valueless_cookie (self ):
355357 # cookies with no value should be saved and loaded consistently
356- filename = test . support .TESTFN
358+ filename = os_helper .TESTFN
357359 c = LWPCookieJar ()
358360 interact_netscape (c , "http://www.acme.com/" , 'boo' )
359361 self .assertEqual (c ._cookies ["www.acme.com" ]["/" ]["boo" ].value , None )
@@ -368,7 +370,7 @@ def test_lwp_valueless_cookie(self):
368370
369371 def test_bad_magic (self ):
370372 # OSErrors (eg. file doesn't exist) are allowed to propagate
371- filename = test . support .TESTFN
373+ filename = os_helper .TESTFN
372374 for cookiejar_class in LWPCookieJar , MozillaCookieJar :
373375 c = cookiejar_class ()
374376 try :
@@ -475,7 +477,7 @@ def test_domain_return_ok(self):
475477 def test_missing_value (self ):
476478 # missing = sign in Cookie: header is regarded by Mozilla as a missing
477479 # name, and by http.cookiejar as a missing value
478- filename = test . support .TESTFN
480+ filename = os_helper .TESTFN
479481 c = MozillaCookieJar (filename )
480482 interact_netscape (c , "http://www.acme.com/" , 'eggs' )
481483 interact_netscape (c , "http://www.acme.com/" , '"spam"; path=/foo/' )
@@ -599,7 +601,7 @@ def test_expires(self):
599601 c = CookieJar ()
600602 future = time2netscape (time .time ()+ 3600 )
601603
602- with test . support .check_no_warnings (self ):
604+ with warnings_helper .check_no_warnings (self ):
603605 headers = [f"Set-Cookie: FOO=BAR; path=/; expires={ future } " ]
604606 req = urllib .request .Request ("http://www.coyote.com/" )
605607 res = FakeResponse (headers , "http://www.coyote.com/" )
@@ -1713,7 +1715,7 @@ def test_rejection(self):
17131715 self .assertEqual (len (c ), 6 )
17141716
17151717 # save and restore
1716- filename = test . support .TESTFN
1718+ filename = os_helper .TESTFN
17171719
17181720 try :
17191721 c .save (filename , ignore_discard = True )
@@ -1753,7 +1755,7 @@ def test_mozilla(self):
17531755 # Save / load Mozilla/Netscape cookie file format.
17541756 year_plus_one = time .localtime ()[0 ] + 1
17551757
1756- filename = test . support .TESTFN
1758+ filename = os_helper .TESTFN
17571759
17581760 c = MozillaCookieJar (filename ,
17591761 policy = DefaultCookiePolicy (rfc2965 = True ))
0 commit comments