@@ -113,7 +113,7 @@ def test_get_home_dir_1():
113113 IPython .__file__ = abspath (join (HOME_TEST_DIR , "Lib/IPython/__init__.py" ))
114114
115115 home_dir = path .get_home_dir ()
116- nt . assert_equal ( home_dir , unfrozen )
116+ assert home_dir == unfrozen
117117
118118
119119@skip_if_not_win32
@@ -127,7 +127,7 @@ def test_get_home_dir_2():
127127 IPython .__file__ = abspath (join (HOME_TEST_DIR , "Library.zip/IPython/__init__.py" )).lower ()
128128
129129 home_dir = path .get_home_dir (True )
130- nt . assert_equal ( home_dir , unfrozen )
130+ assert home_dir == unfrozen
131131
132132
133133@skip_win32_py38
@@ -137,7 +137,7 @@ def test_get_home_dir_3():
137137 env ["HOME" ] = HOME_TEST_DIR
138138 home_dir = path .get_home_dir (True )
139139 # get_home_dir expands symlinks
140- nt . assert_equal ( home_dir , os .path .realpath (env ["HOME" ]) )
140+ assert home_dir == os .path .realpath (env ["HOME" ])
141141
142142
143143@with_environment
@@ -181,7 +181,7 @@ def __exit__(*args, **kwargs):
181181 with patch .object (wreg , 'OpenKey' , return_value = key ()), \
182182 patch .object (wreg , 'QueryValueEx' , return_value = [abspath (HOME_TEST_DIR )]):
183183 home_dir = path .get_home_dir ()
184- nt . assert_equal ( home_dir , abspath (HOME_TEST_DIR ) )
184+ assert home_dir == abspath (HOME_TEST_DIR )
185185
186186@with_environment
187187def test_get_xdg_dir_0 ():
@@ -195,7 +195,7 @@ def test_get_xdg_dir_0():
195195 env .pop ('IPYTHONDIR' , None )
196196 env .pop ('XDG_CONFIG_HOME' , None )
197197
198- nt . assert_equal ( path .get_xdg_dir (), os .path .join (' somewhere' , ' .config' ) )
198+ assert path .get_xdg_dir () == os .path .join (" somewhere" , " .config" )
199199
200200
201201@with_environment
@@ -208,7 +208,7 @@ def test_get_xdg_dir_1():
208208 env .pop ('IPYTHON_DIR' , None )
209209 env .pop ('IPYTHONDIR' , None )
210210 env .pop ('XDG_CONFIG_HOME' , None )
211- nt . assert_equal ( path .get_xdg_dir (), None )
211+ assert path .get_xdg_dir () is None
212212
213213@with_environment
214214def test_get_xdg_dir_2 ():
@@ -224,7 +224,7 @@ def test_get_xdg_dir_2():
224224 if not os .path .exists (cfgdir ):
225225 os .makedirs (cfgdir )
226226
227- nt . assert_equal ( path .get_xdg_dir (), cfgdir )
227+ assert path .get_xdg_dir () == cfgdir
228228
229229@with_environment
230230def test_get_xdg_dir_3 ():
@@ -240,7 +240,7 @@ def test_get_xdg_dir_3():
240240 if not os .path .exists (cfgdir ):
241241 os .makedirs (cfgdir )
242242
243- nt . assert_equal ( path .get_xdg_dir (), None )
243+ assert path .get_xdg_dir () is None
244244
245245def test_filefind ():
246246 """Various tests for filefind"""
@@ -263,13 +263,13 @@ def test_get_long_path_name_win32():
263263 # Test to see if the short path evaluates correctly.
264264 short_path = os .path .join (tmpdir , 'THISIS~1' )
265265 evaluated_path = path .get_long_path_name (short_path )
266- nt . assert_equal ( evaluated_path .lower (), long_path .lower () )
266+ assert evaluated_path .lower () == long_path .lower ()
267267
268268
269269@dec .skip_win32
270270def test_get_long_path_name ():
271- p = path .get_long_path_name (' /usr/local' )
272- nt . assert_equal ( p , ' /usr/local' )
271+ p = path .get_long_path_name (" /usr/local" )
272+ assert p == " /usr/local"
273273
274274
275275class TestRaiseDeprecation (unittest .TestCase ):
@@ -300,18 +300,18 @@ def test_not_writable_ipdir(self):
300300@with_environment
301301def test_get_py_filename ():
302302 os .chdir (TMP_TEST_DIR )
303- with make_tempfile (' foo.py' ):
304- nt . assert_equal ( path .get_py_filename (' foo.py' ), ' foo.py' )
305- nt . assert_equal ( path .get_py_filename (' foo' ), ' foo.py' )
306- with make_tempfile (' foo' ):
307- nt . assert_equal ( path .get_py_filename (' foo' ), ' foo' )
308- nt .assert_raises (IOError , path .get_py_filename , ' foo.py' )
309- nt .assert_raises (IOError , path .get_py_filename , ' foo' )
310- nt .assert_raises (IOError , path .get_py_filename , ' foo.py' )
311- true_fn = ' foo with spaces.py'
303+ with make_tempfile (" foo.py" ):
304+ assert path .get_py_filename (" foo.py" ) == " foo.py"
305+ assert path .get_py_filename (" foo" ) == " foo.py"
306+ with make_tempfile (" foo" ):
307+ assert path .get_py_filename (" foo" ) == " foo"
308+ nt .assert_raises (IOError , path .get_py_filename , " foo.py" )
309+ nt .assert_raises (IOError , path .get_py_filename , " foo" )
310+ nt .assert_raises (IOError , path .get_py_filename , " foo.py" )
311+ true_fn = " foo with spaces.py"
312312 with make_tempfile (true_fn ):
313- nt . assert_equal ( path .get_py_filename (' foo with spaces' ), true_fn )
314- nt . assert_equal ( path .get_py_filename (' foo with spaces.py' ), true_fn )
313+ assert path .get_py_filename (" foo with spaces" ) == true_fn
314+ assert path .get_py_filename (" foo with spaces.py" ) == true_fn
315315 nt .assert_raises (IOError , path .get_py_filename , '"foo with spaces.py"' )
316316 nt .assert_raises (IOError , path .get_py_filename , "'foo with spaces.py'" )
317317
@@ -361,8 +361,7 @@ def in_tempdir(cls):
361361 def check_match (self , patterns , matches ):
362362 with self .in_tempdir ():
363363 # glob returns unordered list. that's why sorted is required.
364- nt .assert_equal (sorted (path .shellglob (patterns )),
365- sorted (matches ))
364+ assert sorted (path .shellglob (patterns )) == sorted (matches )
366365
367366 def common_cases (self ):
368367 return [
@@ -397,12 +396,13 @@ def test_match_windows(self):
397396 yield (self .check_match , patterns , matches )
398397
399398
399+ # TODO : pytest.mark.parametrise once nose is gone.
400400def test_unescape_glob ():
401- nt . assert_equal ( path .unescape_glob (r' \*\[\!\]\?' ), ' *[!]?' )
402- nt . assert_equal ( path .unescape_glob (r' \\*' ), r'\*' )
403- nt . assert_equal ( path .unescape_glob (r' \\\*' ), r'\*' )
404- nt . assert_equal ( path .unescape_glob (r' \\a' ), r'\a' )
405- nt . assert_equal ( path .unescape_glob (r'\a' ), r'\a' )
401+ assert path .unescape_glob (r" \*\[\!\]\?" ) == " *[!]?"
402+ assert path .unescape_glob (r" \\*" ) == r"\*"
403+ assert path .unescape_glob (r" \\\*" ) == r"\*"
404+ assert path .unescape_glob (r" \\a" ) == r"\a"
405+ assert path .unescape_glob (r"\a" ) == r"\a"
406406
407407
408408@onlyif_unicode_paths
@@ -431,17 +431,19 @@ def dst(self, *args):
431431 return os .path .join (self .tempdir .name , * args )
432432
433433 def assert_inode_not_equal (self , a , b ):
434- nt .assert_not_equal (os .stat (a ).st_ino , os .stat (b ).st_ino ,
435- "%r and %r do reference the same indoes" % (a , b ))
434+ assert (
435+ os .stat (a ).st_ino != os .stat (b ).st_ino
436+ ), "%r and %r do reference the same indoes" % (a , b )
436437
437438 def assert_inode_equal (self , a , b ):
438- nt .assert_equal (os .stat (a ).st_ino , os .stat (b ).st_ino ,
439- "%r and %r do not reference the same indoes" % (a , b ))
439+ assert (
440+ os .stat (a ).st_ino == os .stat (b ).st_ino
441+ ), "%r and %r do not reference the same indoes" % (a , b )
440442
441443 def assert_content_equal (self , a , b ):
442444 with open (a ) as a_f :
443445 with open (b ) as b_f :
444- nt . assert_equal ( a_f .read (), b_f .read () )
446+ assert a_f .read () == b_f .read ()
445447
446448 @skip_win32
447449 def test_link_successful (self ):
@@ -489,4 +491,4 @@ def test_link_twice(self):
489491 path .link_or_copy (self .src , dst )
490492 path .link_or_copy (self .src , dst )
491493 self .assert_inode_equal (self .src , dst )
492- nt . assert_equal ( sorted (os .listdir (self .tempdir .name )), [ ' src' , ' target' ])
494+ assert sorted (os .listdir (self .tempdir .name )) == [ " src" , " target" ]
0 commit comments