Description: Use tmp_path instead of tmpdir
Author: Dale Richards <dale@dalerichards.net>
Date: Sun, 3 Dec 2023 16:58:17 +0000
Bug-Debian: https://bugs.debian.org/1002789
Origin: https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1002789;filename=0003-Use-tmp_path-instead-of-tmpdir.patch;msg=74
Last-Update: 2024-01-23

--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -12,9 +12,3 @@
     for item in items:
         if 'slow' in item.keywords:
             item.add_marker(skip_slow)
-
-def pytest_runtest_teardown(item):
-    if 'tmpdir' in item.funcargs:
-        tmpdir = item.funcargs['tmpdir']
-        if tmpdir.check():
-            tmpdir.remove()
--- a/tests/integration/test_facade.py
+++ b/tests/integration/test_facade.py
@@ -17,7 +17,7 @@
 from test_common import *
 
 
-def test_facade_iso9660_get_file_from_iso(tmpdir):
+def test_facade_iso9660_get_file_from_iso(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new()
 
@@ -26,7 +26,7 @@
     foostr = b'foo\n'
     facade.add_fp(BytesIO(foostr), len(foostr), '/FOO.;1')
 
-    foofile = os.path.join(str(tmpdir), 'foo')
+    foofile = os.path.join(str(tmp_path), 'foo')
     facade.get_file_from_iso(foofile, '/FOO.;1')
 
     iso.close()
@@ -95,11 +95,11 @@
 
     iso.close()
 
-def test_facade_iso9660_add_file(tmpdir):
+def test_facade_iso9660_add_file(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new()
 
-    testout = tmpdir.join('writetest.iso')
+    testout = tmp_path / 'writetest.iso'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -114,11 +114,11 @@
 
     iso.close()
 
-def test_facade_iso9660_add_file_with_rr(tmpdir):
+def test_facade_iso9660_add_file_with_rr(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(rock_ridge='1.09')
 
-    testout = tmpdir.join('writetest.iso')
+    testout = tmp_path / 'writetest.iso'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -269,7 +269,7 @@
         facade = pycdlib.facade.PyCdlibJoliet(iso)
     assert(str(excinfo.value) == 'Can only instantiate a Joliet facade for a Joliet ISO')
 
-def test_facade_joliet_get_file_from_iso(tmpdir):
+def test_facade_joliet_get_file_from_iso(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(joliet=3)
 
@@ -278,7 +278,7 @@
     foostr = b'foo\n'
     facade.add_fp(BytesIO(foostr), len(foostr), '/foo')
 
-    foofile = os.path.join(str(tmpdir), 'foo')
+    foofile = os.path.join(str(tmp_path), 'foo')
     facade.get_file_from_iso(foofile, '/foo')
 
     iso.close()
@@ -318,11 +318,11 @@
 
     iso.close()
 
-def test_facade_joliet_add_file(tmpdir):
+def test_facade_joliet_add_file(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(joliet=3)
 
-    testout = tmpdir.join('writetest.iso')
+    testout = tmp_path / 'writetest.iso'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -460,7 +460,7 @@
         facade = pycdlib.facade.PyCdlibRockRidge(iso)
     assert(str(excinfo.value) == 'Can only instantiate a Rock Ridge facade for a Rock Ridge ISO')
 
-def test_facade_rock_ridge_get_file_from_iso(tmpdir):
+def test_facade_rock_ridge_get_file_from_iso(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(rock_ridge='1.09')
 
@@ -469,7 +469,7 @@
     foostr = b'foo\n'
     facade.add_fp(BytesIO(foostr), len(foostr), '/foo', 0o040555)
 
-    foofile = os.path.join(str(tmpdir), 'foo')
+    foofile = os.path.join(str(tmp_path), 'foo')
     facade.get_file_from_iso(foofile, '/foo')
 
     iso.close()
@@ -522,11 +522,11 @@
 
     iso.close()
 
-def test_facade_rock_ridge_add_file(tmpdir):
+def test_facade_rock_ridge_add_file(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(rock_ridge='1.09')
 
-    testout = tmpdir.join('writetest.iso')
+    testout = tmp_path / 'writetest.iso'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -731,7 +731,7 @@
         facade = pycdlib.facade.PyCdlibUDF(iso)
     assert(str(excinfo.value) == 'Can only instantiate a UDF facade for a UDF ISO')
 
-def test_facade_udf_get_file_from_iso(tmpdir):
+def test_facade_udf_get_file_from_iso(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(udf='2.60')
 
@@ -740,7 +740,7 @@
     foostr = b'foo\n'
     facade.add_fp(BytesIO(foostr), len(foostr), '/foo')
 
-    foofile = os.path.join(str(tmpdir), 'foo')
+    foofile = os.path.join(str(tmp_path), 'foo')
     facade.get_file_from_iso(foofile, '/foo')
 
     iso.close()
@@ -780,11 +780,11 @@
 
     iso.close()
 
-def test_facade_udf_add_file(tmpdir):
+def test_facade_udf_add_file(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(udf='2.60')
 
-    testout = tmpdir.join('writetest.iso')
+    testout = tmp_path / 'writetest.iso'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
--- a/tests/integration/test_hybrid.py
+++ b/tests/integration/test_hybrid.py
@@ -25,9 +25,10 @@
     check_func(iso2, len(out.getvalue()))
     iso2.close()
 
-def test_hybrid_nofiles(tmpdir):
+def test_hybrid_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('nofiles')
+    indir = tmp_path / 'nofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -45,9 +46,10 @@
 
     iso.close()
 
-def test_hybrid_onefile(tmpdir):
+def test_hybrid_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -64,9 +66,10 @@
 
     iso.close()
 
-def test_hybrid_onedir(tmpdir):
+def test_hybrid_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -82,9 +85,10 @@
 
     iso.close()
 
-def test_hybrid_twofiles(tmpdir):
+def test_hybrid_twofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -103,9 +107,10 @@
 
     iso.close()
 
-def test_hybrid_twofiles2(tmpdir):
+def test_hybrid_twofiles2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'bar'), 'wb') as outfp:
         outfp.write(b'bar\n')
@@ -124,9 +129,10 @@
 
     iso.close()
 
-def test_hybrid_twofiles3(tmpdir):
+def test_hybrid_twofiles3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -146,9 +152,10 @@
 
     iso.close()
 
-def test_hybrid_twofiles4(tmpdir):
+def test_hybrid_twofiles4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -168,11 +175,13 @@
 
     iso.close()
 
-def test_hybrid_twodirs(tmpdir):
+def test_hybrid_twodirs(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twodir')
+    indir = tmp_path / 'twodir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('aa')
+    newdir = indir / 'aa'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -187,11 +196,13 @@
 
     iso.close()
 
-def test_hybrid_twodirs2(tmpdir):
+def test_hybrid_twodirs2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twodir')
+    indir = tmp_path / 'twodir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('bb')
+    newdir = indir / 'bb'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -206,9 +217,10 @@
 
     iso.close()
 
-def test_hybrid_twodirs3(tmpdir):
+def test_hybrid_twodirs3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twodir')
+    indir = tmp_path / 'twodir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -225,9 +237,10 @@
 
     iso.close()
 
-def test_hybrid_twodirs4(tmpdir):
+def test_hybrid_twodirs4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twodir')
+    indir = tmp_path / 'twodir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -244,9 +257,10 @@
 
     iso.close()
 
-def test_hybrid_rmfile(tmpdir):
+def test_hybrid_rmfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -266,13 +280,15 @@
 
     iso.close()
 
-def test_hybrid_rmdir(tmpdir):
+def test_hybrid_rmdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -287,9 +303,10 @@
 
     iso.close()
 
-def test_hybrid_onefileonedir(tmpdir):
+def test_hybrid_onefileonedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -307,11 +324,13 @@
 
     iso.close()
 
-def test_hybrid_onefileonedir2(tmpdir):
+def test_hybrid_onefileonedir2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -327,9 +346,10 @@
 
     iso.close()
 
-def test_hybrid_onefileonedir3(tmpdir):
+def test_hybrid_onefileonedir3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -348,9 +368,10 @@
 
     iso.close()
 
-def test_hybrid_onefileonedir4(tmpdir):
+def test_hybrid_onefileonedir4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -369,9 +390,10 @@
 
     iso.close()
 
-def test_hybrid_onefile_onedirwithfile(tmpdir):
+def test_hybrid_onefile_onedirwithfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -392,11 +414,13 @@
 
     iso.close()
 
-def test_hybrid_onefile_onedirwithfile2(tmpdir):
+def test_hybrid_onefile_onedirwithfile2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -415,9 +439,10 @@
 
     iso.close()
 
-def test_hybrid_onefile_onedirwithfile3(tmpdir):
+def test_hybrid_onefile_onedirwithfile3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -439,11 +464,13 @@
 
     iso.close()
 
-def test_hybrid_onefile_onedirwithfile4(tmpdir):
+def test_hybrid_onefile_onedirwithfile4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'bar'), 'wb') as outfp:
         outfp.write(b'bar\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
@@ -461,9 +488,10 @@
 
     iso.close()
 
-def test_hybrid_twoextentfile(tmpdir):
+def test_hybrid_twoextentfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -485,13 +513,15 @@
 
     iso.close()
 
-def test_hybrid_ptr_extent(tmpdir):
+def test_hybrid_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('manydirs')
+    indir = tmp_path / 'manydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 293
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -507,13 +537,15 @@
 
     iso.close()
 
-def test_hybrid_ptr_extent2(tmpdir):
+def test_hybrid_ptr_extent2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('manydirs')
+    indir = tmp_path / 'manydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 295
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -529,13 +561,15 @@
 
     iso.close()
 
-def test_hybrid_remove_many(tmpdir):
+def test_hybrid_remove_many(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('manydirs')
+    indir = tmp_path / 'manydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 295
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -552,11 +586,13 @@
 
     iso.close()
 
-def test_hybrid_twoleveldeepdir(tmpdir):
+def test_hybrid_twoleveldeepdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twoleveldeep')
+    indir = tmp_path / 'twoleveldeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -571,9 +607,10 @@
 
     iso.close()
 
-def test_hybrid_twoleveldeepdir2(tmpdir):
+def test_hybrid_twoleveldeepdir2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twoleveldeep')
+    indir = tmp_path / 'twoleveldeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -591,12 +628,15 @@
 
     iso.close()
 
-def test_hybrid_rmsubdir(tmpdir):
+def test_hybrid_rmsubdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twoleveldeep')
+    indir = tmp_path / 'twoleveldeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
-    dir1.mkdir('subdir1')
+    dir1 = indir / 'dir1'
+    dir1.mkdir()
+    subdir = dir1 / 'subdir1'
+    subdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -611,12 +651,15 @@
 
     iso.close()
 
-def test_hybrid_removeall(tmpdir):
+def test_hybrid_removeall(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twoleveldeep')
+    indir = tmp_path / 'twoleveldeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
-    dir1.mkdir('subdir1')
+    dir1 = indir / 'dir1'
+    dir1.mkdir()
+    subdir = dir1 / 'subdir1'
+    subdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -632,11 +675,13 @@
 
     iso.close()
 
-def test_hybrid_add_new_file_to_subdir(tmpdir):
+def test_hybrid_add_new_file_to_subdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twoleveldeep')
+    indir = tmp_path / 'twoleveldeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -654,9 +699,10 @@
 
     iso.close()
 
-def test_hybrid_eltorito_add(tmpdir):
+def test_hybrid_eltorito_add(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritohybrid')
+    indir = tmp_path / 'eltoritohybrid'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -675,9 +721,10 @@
 
     iso.close()
 
-def test_hybrid_eltorito_remove(tmpdir):
+def test_hybrid_eltorito_remove(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -697,9 +744,10 @@
 
     iso.close()
 
-def test_hybrid_eltorito_add_bootcat(tmpdir):
+def test_hybrid_eltorito_add_bootcat(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritotwofile')
+    indir = tmp_path / 'eltoritotwofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -718,9 +766,10 @@
 
     iso.close()
 
-def test_hybrid_rr_nofiles(tmpdir):
+def test_hybrid_rr_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrnofiles')
+    indir = tmp_path / 'rrnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -738,9 +787,10 @@
 
     iso.close()
 
-def test_hybrid_rr_onefile(tmpdir):
+def test_hybrid_rr_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rronefile')
+    indir = tmp_path / 'rronefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -757,9 +807,10 @@
 
     iso.close()
 
-def test_hybrid_rr_rmfile(tmpdir):
+def test_hybrid_rr_rmfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrrmfile')
+    indir = tmp_path / 'rrrmfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -779,9 +830,10 @@
 
     iso.close()
 
-def test_hybrid_rr_onefileonedir(tmpdir):
+def test_hybrid_rr_onefileonedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rronefileonedir')
+    indir = tmp_path / 'rronefileonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -799,11 +851,13 @@
 
     iso.close()
 
-def test_hybrid_rr_onefileonedirwithfile(tmpdir):
+def test_hybrid_rr_onefileonedirwithfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rronefileonedirwithfile')
+    indir = tmp_path / 'rronefileonedirwithfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
@@ -822,9 +876,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_joliet_nofiles(tmpdir):
+def test_hybrid_rr_and_joliet_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrjolietnofiles')
+    indir = tmp_path / 'rrjolietnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -842,9 +897,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_joliet_onefile(tmpdir):
+def test_hybrid_rr_and_joliet_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrjolietonefile')
+    indir = tmp_path / 'rrjolietonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
@@ -861,9 +917,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_nofiles(tmpdir):
+def test_hybrid_rr_and_eltorito_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritonofiles')
+    indir = tmp_path / 'rreltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -881,9 +938,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_nofiles2(tmpdir):
+def test_hybrid_rr_and_eltorito_nofiles2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritonofiles2')
+    indir = tmp_path / 'rreltoritonofiles2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -901,9 +959,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_onefile(tmpdir):
+def test_hybrid_rr_and_eltorito_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritoonefile')
+    indir = tmp_path / 'rreltoritoonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -924,9 +983,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_onefile2(tmpdir):
+def test_hybrid_rr_and_eltorito_onefile2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritoonefile2')
+    indir = tmp_path / 'rreltoritoonefile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -946,9 +1006,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_onefile3(tmpdir):
+def test_hybrid_rr_and_eltorito_onefile3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritoonefile3')
+    indir = tmp_path / 'rreltoritoonefile3'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -968,9 +1029,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_onedir(tmpdir):
+def test_hybrid_rr_and_eltorito_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritoonedir')
+    indir = tmp_path / 'rreltoritoonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -990,9 +1052,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_onedir2(tmpdir):
+def test_hybrid_rr_and_eltorito_onedir2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritoonedir2')
+    indir = tmp_path / 'rreltoritoonedir2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -1012,11 +1075,13 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_onedir3(tmpdir):
+def test_hybrid_rr_and_eltorito_onedir3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritoonedir3')
+    indir = tmp_path / 'rreltoritoonedir3'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
@@ -1033,9 +1098,10 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_onedir4(tmpdir):
+def test_hybrid_rr_and_eltorito_onedir4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritoonedir4')
+    indir = tmp_path / 'rreltoritoonedir4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1054,13 +1120,15 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_rmdir(tmpdir):
+def test_hybrid_rr_and_eltorito_rmdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritormdir')
+    indir = tmp_path / 'rreltoritormdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -1076,14 +1144,17 @@
 
     iso.close()
 
-def test_hybrid_rr_and_eltorito_rmdir2(tmpdir):
+def test_hybrid_rr_and_eltorito_rmdir2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rreltoritormdir2')
+    indir = tmp_path / 'rreltoritormdir2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
-    dir1 = indir.mkdir('dir1')
-    dir1.mkdir('subdir1')
+    dir1 = indir / 'dir1'
+    dir1.mkdir()
+    subdir = dir1 / 'subdir1'
+    subdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -1099,9 +1170,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_and_eltorito_remove(tmpdir):
+def test_hybrid_joliet_and_eltorito_remove(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoremove')
+    indir = tmp_path / 'jolieteltoritoremove'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1122,9 +1194,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_and_eltorito_onefile(tmpdir):
+def test_hybrid_joliet_and_eltorito_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoonefile')
+    indir = tmp_path / 'jolieteltoritoonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1144,9 +1217,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_and_eltorito_onefile2(tmpdir):
+def test_hybrid_joliet_and_eltorito_onefile2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoonefile2')
+    indir = tmp_path / 'jolieteltoritoonefile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1168,9 +1242,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_and_eltorito_onefile3(tmpdir):
+def test_hybrid_joliet_and_eltorito_onefile3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoonefile3')
+    indir = tmp_path / 'jolieteltoritoonefile3'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1191,11 +1266,13 @@
 
     iso.close()
 
-def test_hybrid_joliet_and_eltorito_onedir(tmpdir):
+def test_hybrid_joliet_and_eltorito_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoonedir')
+    indir = tmp_path / 'jolieteltoritoonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
@@ -1213,9 +1290,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_and_eltorito_onedir2(tmpdir):
+def test_hybrid_joliet_and_eltorito_onedir2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoonedir2')
+    indir = tmp_path / 'jolieteltoritoonedir2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1234,9 +1312,10 @@
 
     iso.close()
 
-def test_hybrid_isohybrid(tmpdir):
+def test_hybrid_isohybrid(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybrid')
+    indir = tmp_path / 'isohybrid'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1256,9 +1335,10 @@
 
     iso.close()
 
-def test_hybrid_isohybrid2(tmpdir):
+def test_hybrid_isohybrid2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybrid')
+    indir = tmp_path / 'isohybrid'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'isolinux.bin'), 'wb') as outfp:
         outfp.seek(0x40)
@@ -1281,9 +1361,10 @@
 
 @pytest.mark.skipif(find_executable('isohybrid') is None,
                     reason='syslinux not installed')
-def test_hybrid_isohybrid3(tmpdir):
+def test_hybrid_isohybrid3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybrid')
+    indir = tmp_path / 'isohybrid'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'isolinux.bin'), 'wb') as outfp:
         outfp.seek(0x40)
@@ -1307,9 +1388,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_nofiles(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritonofiles')
+    indir = tmp_path / 'jolietrreltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1330,9 +1412,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_nofiles2(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_nofiles2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritonofiles2')
+    indir = tmp_path / 'jolietrreltoritonofiles2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
@@ -1351,9 +1434,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_onefile(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritoonefile')
+    indir = tmp_path / 'jolietrreltoritoonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1373,9 +1457,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_onefile2(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_onefile2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritoonefile2')
+    indir = tmp_path / 'jolietrreltoritoonefile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1396,9 +1481,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_onefile3(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_onefile3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritoonefile3')
+    indir = tmp_path / 'jolietrreltoritoonefile3'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
@@ -1420,11 +1506,13 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_onedir(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritoonedir')
+    indir = tmp_path / 'jolietrreltoritoonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
 
@@ -1442,9 +1530,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_onedir2(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_onedir2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritoonedir2')
+    indir = tmp_path / 'jolietrreltoritoonedir2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
@@ -1465,9 +1554,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_rr_and_eltorito_onedir3(tmpdir):
+def test_hybrid_joliet_rr_and_eltorito_onedir3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrreltoritoonedir2')
+    indir = tmp_path / 'jolietrreltoritoonedir2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1486,9 +1576,10 @@
 
     iso.close()
 
-def test_hybrid_rr_rmfile2(tmpdir):
+def test_hybrid_rr_rmfile2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrrmfile2')
+    indir = tmp_path / 'rrrmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1506,11 +1597,13 @@
 
     iso.close()
 
-def test_hybrid_rr_rmdir(tmpdir):
+def test_hybrid_rr_rmdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrrmfile2')
+    indir = tmp_path / 'rrrmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
@@ -1525,11 +1618,13 @@
 
     iso.close()
 
-def test_hybrid_xa_nofiles(tmpdir):
+def test_hybrid_xa_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-o', str(outfile), str(indir)])
 
@@ -1544,9 +1639,10 @@
 
     iso.close()
 
-def test_hybrid_xa_nofiles2(tmpdir):
+def test_hybrid_xa_nofiles2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1564,9 +1660,10 @@
 
     iso.close()
 
-def test_hybrid_xa_onefile(tmpdir):
+def test_hybrid_xa_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-o', str(outfile), str(indir)])
@@ -1583,9 +1680,10 @@
 
     iso.close()
 
-def test_hybrid_xa_onedir(tmpdir):
+def test_hybrid_xa_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-o', str(outfile), str(indir)])
@@ -1601,14 +1699,16 @@
 
     iso.close()
 
-def test_hybrid_sevendeepdirs(tmpdir):
+def test_hybrid_sevendeepdirs(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('sevendeepdirs')
+    indir = tmp_path / 'sevendeepdirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 8
     x = indir
     for i in range(1, 1+numdirs):
-        x = x.mkdir('dir%d' % i)
+        x = x / ('dir%d' % i)
+        x.mkdir(parents=True)
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
@@ -1623,9 +1723,10 @@
 
     iso.close()
 
-def test_hybrid_xa_joliet_onedir(tmpdir):
+def test_hybrid_xa_joliet_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-J', '-o', str(outfile), str(indir)])
@@ -1641,9 +1742,10 @@
 
     iso.close()
 
-def test_hybrid_xa_joliet_onefile(tmpdir):
+def test_hybrid_xa_joliet_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-J', '-o', str(outfile), str(indir)])
@@ -1660,9 +1762,10 @@
 
     iso.close()
 
-def test_hybrid_isolevel4_onefile(tmpdir):
+def test_hybrid_isolevel4_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1682,13 +1785,15 @@
 
     iso.close()
 
-def test_hybrid_isolevel4_onefile2(tmpdir):
+def test_hybrid_isolevel4_onefile2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarmfile2')
+    indir = tmp_path / 'xarmfile2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -1703,9 +1808,10 @@
 
     iso.close()
 
-def test_hybrid_isolevel4_eltorito(tmpdir):
+def test_hybrid_isolevel4_eltorito(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isolevel4eltorito')
+    indir = tmp_path / 'isolevel4eltorito'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1724,9 +1830,10 @@
 
     iso.close()
 
-def test_hybrid_isolevel4_eltorito2(tmpdir):
+def test_hybrid_isolevel4_eltorito2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isolevel4eltorito')
+    indir = tmp_path / 'isolevel4eltorito'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1746,9 +1853,10 @@
 
     iso.close()
 
-def test_hybrid_eltorito_multi_boot(tmpdir):
+def test_hybrid_eltorito_multi_boot(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1769,9 +1877,10 @@
 
     iso.close()
 
-def test_hybrid_eltorito_multi_boot_boot_info(tmpdir):
+def test_hybrid_eltorito_multi_boot_boot_info(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1792,9 +1901,10 @@
 
     iso.close()
 
-def test_hybrid_eltorito_multi_boot_hard_link(tmpdir):
+def test_hybrid_eltorito_multi_boot_hard_link(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1822,9 +1932,10 @@
     checkfunc(iso, os.stat(str(outfile)).st_size)
     iso.close()
 
-def test_hybrid_modify_in_place_onefile(tmpdir):
+def test_hybrid_modify_in_place_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceonefile')
+    indir = tmp_path / 'modifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1841,9 +1952,10 @@
     # Now re-open it and check things out.
     open_and_check(outfile, check_onefile)
 
-def test_hybrid_joliet_modify_in_place_onefile(tmpdir):
+def test_hybrid_joliet_modify_in_place_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietmodifyinplaceonefile')
+    indir = tmp_path / 'jolietmodifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1860,9 +1972,10 @@
     # Now re-open it and check things out.
     open_and_check(outfile, check_joliet_onefile)
 
-def test_hybrid_modify_in_place_iso_level4_onefile(tmpdir):
+def test_hybrid_modify_in_place_iso_level4_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1879,9 +1992,10 @@
     # Now open up the ISO with pycdlib and modify it.
     open_and_check(outfile, check_isolevel4_onefile)
 
-def test_hybrid_modify_in_place_udf(tmpdir):
+def test_hybrid_modify_in_place_udf(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceoneudf')
+    indir = tmp_path / 'modifyinplaceoneudf'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1898,9 +2012,10 @@
     # Now open up the ISO with pycdlib and modify it.
     open_and_check(outfile, check_udf_onefile)
 
-def test_hybrid_modify_in_place_udf_shrink(tmpdir):
+def test_hybrid_modify_in_place_udf_shrink(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceoneudfshrink')
+    indir = tmp_path / 'modifyinplaceoneudfshrink'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foobarbaz\n')
@@ -1917,9 +2032,10 @@
     # Now open up the ISO with pycdlib and modify it.
     open_and_check(outfile, check_udf_onefile)
 
-def test_hybrid_try_to_use_new_on_open_file(tmpdir):
+def test_hybrid_try_to_use_new_on_open_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1936,9 +2052,10 @@
 
     iso.close()
 
-def test_hybrid_try_to_use_open_on_new_file(tmpdir):
+def test_hybrid_try_to_use_open_on_new_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1953,9 +2070,10 @@
 
     iso.close()
 
-def test_hybrid_modify_in_place_not_initialized(tmpdir):
+def test_hybrid_modify_in_place_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceonefile')
+    indir = tmp_path / 'modifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1970,9 +2088,10 @@
         iso.modify_file_in_place(BytesIO(foostr), len(foostr), '/FOO.;1', rr_name='foo', joliet_path='/foo')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_hybrid_modify_in_place_read_only(tmpdir):
+def test_hybrid_modify_in_place_read_only(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceonefile')
+    indir = tmp_path / 'modifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1992,9 +2111,10 @@
 
         iso.close()
 
-def test_hybrid_add_isohybrid_file_wrong_size(tmpdir):
+def test_hybrid_add_isohybrid_file_wrong_size(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceonefile')
+    indir = tmp_path / 'modifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2016,9 +2136,10 @@
 
     iso.close()
 
-def test_hybrid_add_isohybrid_no_eltorito(tmpdir):
+def test_hybrid_add_isohybrid_no_eltorito(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceonefile')
+    indir = tmp_path / 'modifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -2034,9 +2155,10 @@
 
     iso.close()
 
-def test_hybrid_eltorito_remove_not_initialized(tmpdir):
+def test_hybrid_eltorito_remove_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2051,9 +2173,10 @@
         iso.rm_eltorito()
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_hybrid_eltorito_remove_not_present(tmpdir):
+def test_hybrid_eltorito_remove_not_present(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2071,13 +2194,15 @@
 
     iso.close()
 
-def test_hybrid_rmdir_not_initialized(tmpdir):
+def test_hybrid_rmdir_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -2088,13 +2213,15 @@
         iso.rm_directory('/DIR1')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_hybrid_rmdir_slash(tmpdir):
+def test_hybrid_rmdir_slash(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -2109,13 +2236,15 @@
 
     iso.close()
 
-def test_hybrid_rmdir_not_dir(tmpdir):
+def test_hybrid_rmdir_not_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -2130,13 +2259,15 @@
 
     iso.close()
 
-def test_hybrid_rmdir_not_empty(tmpdir):
+def test_hybrid_rmdir_not_empty(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'bar'), 'wb') as outfp:
         outfp.write(b'bar\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
@@ -2153,9 +2284,10 @@
 
     iso.close()
 
-def test_hybrid_rmfile_not_initialized(tmpdir):
+def test_hybrid_rmfile_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoremove')
+    indir = tmp_path / 'jolieteltoritoremove'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2169,9 +2301,10 @@
         iso.rm_file('/BOOT.;1')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_hybrid_rmfile_bad_filename(tmpdir):
+def test_hybrid_rmfile_bad_filename(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolieteltoritoremove')
+    indir = tmp_path / 'jolieteltoritoremove'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2189,11 +2322,13 @@
 
     iso.close()
 
-def test_hybrid_rmfile_not_file(tmpdir):
+def test_hybrid_rmfile_not_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -2208,9 +2343,10 @@
 
     iso.close()
 
-def test_hybrid_add_directory_not_initialized(tmpdir):
+def test_hybrid_add_directory_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -2222,9 +2358,10 @@
         iso.add_directory('/DIR1')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_hybrid_addfile_not_initialized(tmpdir):
+def test_hybrid_addfile_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rmdir')
+    indir = tmp_path / 'rmdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -2237,9 +2374,10 @@
         iso.add_fp(BytesIO(foostr), len(foostr), '/FOO.;1')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_hybrid_modify_in_place_bad_path(tmpdir):
+def test_hybrid_modify_in_place_bad_path(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -2258,9 +2396,10 @@
 
     iso.close()
 
-def test_hybrid_modify_in_place_grow_file(tmpdir):
+def test_hybrid_modify_in_place_grow_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -2279,13 +2418,15 @@
 
     iso.close()
 
-def test_hybrid_modify_in_place_modify_dir(tmpdir):
+def test_hybrid_modify_in_place_modify_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -2301,9 +2442,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_isolevel4(tmpdir):
+def test_hybrid_joliet_isolevel4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietisolevel4')
+    indir = tmp_path / 'jolietisolevel4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2321,11 +2463,13 @@
 
     iso.close()
 
-def test_hybrid_joliet_isolevel4_2(tmpdir):
+def test_hybrid_joliet_isolevel4_2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietisolevel4')
+    indir = tmp_path / 'jolietisolevel4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
@@ -2341,9 +2485,10 @@
 
     iso.close()
 
-def test_hybrid_joliet_isolevel4_3(tmpdir):
+def test_hybrid_joliet_isolevel4_3(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietisolevel4')
+    indir = tmp_path / 'jolietisolevel4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -2362,11 +2507,13 @@
 
     iso.close()
 
-def test_hybrid_eltorito_remove_with_dir(tmpdir):
+def test_hybrid_eltorito_remove_with_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('a')
+    newdir = indir / 'a'
+    newdir.mkdir()
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
@@ -2386,11 +2533,13 @@
 
     iso.close()
 
-def test_hybrid_modify_in_place_dirrecord_spillover(tmpdir):
+def test_hybrid_modify_in_place_dirrecord_spillover(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceonefile')
+    indir = tmp_path / 'modifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     for i in range(1, 49):
         fname = os.path.join(str(dir1), 'foo%.2d' % (i))
         with open(fname, 'wb') as outfp:
@@ -2408,11 +2557,13 @@
     # Now open up the ISO with pycdlib and modify it.
     open_and_check(outfile, check_modify_in_place_spillover)
 
-def test_hybrid_modify_in_place_dirrecord_spillover2(tmpdir):
+def test_hybrid_modify_in_place_dirrecord_spillover2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceonefile')
+    indir = tmp_path / 'modifyinplaceonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     for i in range(1, 49):
         fname = os.path.join(str(dir1), 'foo%.2d' % (i))
         with open(fname, 'wb') as outfp:
@@ -2430,11 +2581,13 @@
     # Now open up the ISO with pycdlib and modify it.
     open_and_check(outfile, check_modify_in_place_spillover)
 
-def test_hybrid_shuffle_deep(tmpdir):
+def test_hybrid_shuffle_deep(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrdeepreshuffle')
+    indir = tmp_path / 'rrdeepreshuffle'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8'
+    newdir.mkdir(parents=True)
     with open(os.path.join(str(indir), 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', 'dir6', 'dir7', 'dir8', 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
@@ -2494,9 +2647,10 @@
 
     iso.close()
 
-def test_hybrid_hidden_file(tmpdir):
+def test_hybrid_hidden_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'aaaaaaaa'), 'wb') as outfp:
         outfp.write(b'aa\n')
@@ -2513,11 +2667,13 @@
 
     iso.close()
 
-def test_hybrid_hidden_dir(tmpdir):
+def test_hybrid_hidden_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -2532,9 +2688,10 @@
 
     iso.close()
 
-def test_hybrid_clear_hidden_file(tmpdir):
+def test_hybrid_clear_hidden_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2551,11 +2708,13 @@
 
     iso.close()
 
-def test_hybrid_clear_hidden_dir(tmpdir):
+def test_hybrid_clear_hidden_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-hidden', 'dir1', '-o', str(outfile), str(indir)])
 
@@ -2572,9 +2731,10 @@
 
 @pytest.mark.skipif(find_executable('isohybrid') is None,
                     reason='syslinux not installed')
-def test_hybrid_isohybrid_file_before(tmpdir):
+def test_hybrid_isohybrid_file_before(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybrid')
+    indir = tmp_path / 'isohybrid'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'isolinux.bin'), 'wb') as outfp:
         outfp.seek(0x40)
@@ -2597,13 +2757,15 @@
 
     iso.close()
 
-def test_hybrid_joliet_dirs_ptr_extent(tmpdir):
+def test_hybrid_joliet_dirs_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietmanydirs')
+    indir = tmp_path / 'jolietmanydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 214
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
@@ -2619,13 +2781,15 @@
 
     iso.close()
 
-def test_hybrid_joliet_dirs_ptr_extent2(tmpdir):
+def test_hybrid_joliet_dirs_ptr_extent2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietmanydirs')
+    indir = tmp_path / 'jolietmanydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 216
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
@@ -2640,13 +2804,15 @@
 
     iso.close()
 
-def test_hybrid_joliet_dirs_add_ptr_extent(tmpdir):
+def test_hybrid_joliet_dirs_add_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('dirsaddptrextent')
+    indir = tmp_path / 'dirsaddptrextent'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 293
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
@@ -2662,13 +2828,15 @@
 
     iso.close()
 
-def test_hybrid_joliet_dirs_rm_ptr_extent(tmpdir):
+def test_hybrid_joliet_dirs_rm_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('dirsrmptrextent')
+    indir = tmp_path / 'dirsrmptrextent'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 295
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
@@ -2684,13 +2852,15 @@
 
     iso.close()
 
-def test_hybrid_joliet_rm_large_directory(tmpdir):
+def test_hybrid_joliet_rm_large_directory(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('dirsrmptrextent')
+    indir = tmp_path / 'dirsrmptrextent'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 50
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
@@ -2706,16 +2876,17 @@
 
     iso.close()
 
-def test_hybrid_set_relocated_name_not_initialized(tmpdir):
+def test_hybrid_set_relocated_name_not_initialized(tmp_path):
     iso = pycdlib.PyCdlib()
 
     with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
         iso.set_relocated_name('RR_MOVED', 'rr_moved')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_hybrid_set_relocated_not_rockridge(tmpdir):
+def test_hybrid_set_relocated_not_rockridge(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('setrelocatednotrr')
+    indir = tmp_path / 'setrelocatednotrr'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -2731,9 +2902,10 @@
 
     iso.close()
 
-def test_hybrid_set_relocated_change_name(tmpdir):
+def test_hybrid_set_relocated_change_name(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('setrelocatednotrr')
+    indir = tmp_path / 'setrelocatednotrr'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -2751,9 +2923,10 @@
 
     iso.close()
 
-def test_hybrid_set_relocated_same_name(tmpdir):
+def test_hybrid_set_relocated_same_name(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('setrelocatednotrr')
+    indir = tmp_path / 'setrelocatednotrr'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -2769,9 +2942,10 @@
 
     iso.close()
 
-def test_hybrid_rr_hidden_relocated(tmpdir):
+def test_hybrid_rr_hidden_relocated(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('setrelocatednotrr')
+    indir = tmp_path / 'setrelocatednotrr'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
@@ -2800,11 +2974,13 @@
 
     iso.close()
 
-def test_hybrid_rr_relocated_list_dir(tmpdir):
+def test_hybrid_rr_relocated_list_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrdeeplistdir')
+    indir = tmp_path / 'rrdeeplistdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8').mkdir('dir9')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8' / 'dir9'
+    newdir.mkdir(parents=True)
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
@@ -2829,8 +3005,9 @@
         else:
             assert(False)
 
-def test_hybrid_rm_hard_link(tmpdir):
-    indir = tmpdir.mkdir('rmhardlink')
+def test_hybrid_rm_hard_link(tmp_path):
+    indir = tmp_path / 'rmhardlink'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2847,8 +3024,9 @@
 
     iso.close()
 
-def test_hybrid_udf_onedir(tmpdir):
-    indir = tmpdir.mkdir('udfnofiles')
+def test_hybrid_udf_onedir(tmp_path):
+    indir = tmp_path / 'udfnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
@@ -2864,8 +3042,9 @@
 
     iso.close()
 
-def test_hybrid_udf_twodirs(tmpdir):
-    indir = tmpdir.mkdir('udfnofiles')
+def test_hybrid_udf_twodirs(tmp_path):
+    indir = tmp_path / 'udfnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
@@ -2882,10 +3061,12 @@
 
     iso.close()
 
-def test_hybrid_udf_twodirs2(tmpdir):
-    indir = tmpdir.mkdir('udfnofiles')
+def test_hybrid_udf_twodirs2(tmp_path):
+    indir = tmp_path / 'udfnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
@@ -2900,12 +3081,13 @@
 
     iso.close()
 
-def test_hybrid_udf_dir_oneshort(tmpdir):
-    indir = tmpdir.mkdir('udfdironeshort')
+def test_hybrid_udf_dir_oneshort(tmp_path):
+    indir = tmp_path / 'udfdironeshort'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     for i in range(ord('a'), ord('v')):
-        dirname = chr(i) * 64
-        indir.mkdir(dirname)
+        dirname = indir / (chr(i) * 64)
+        dirname.mkdir()
 
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
@@ -2921,8 +3103,9 @@
 
     iso.close()
 
-def test_hybrid_udf_zero_udf_file_entry(tmpdir):
-    indir = tmpdir.mkdir('udfzerofileentry')
+def test_hybrid_udf_zero_udf_file_entry(tmp_path):
+    indir = tmp_path / 'udfzerofileentry'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
@@ -2944,8 +3127,9 @@
 
     iso.close()
 
-def test_hybrid_udf_rm_zero_udf_file_entry(tmpdir):
-    indir = tmpdir.mkdir('udfzerofileentry')
+def test_hybrid_udf_rm_zero_udf_file_entry(tmp_path):
+    indir = tmp_path / 'udfzerofileentry'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
@@ -2970,8 +3154,9 @@
 
     iso.close()
 
-def test_hybrid_udf_rm_hard_link_zero_udf_file_entry(tmpdir):
-    indir = tmpdir.mkdir('udfzerofileentry')
+def test_hybrid_udf_rm_hard_link_zero_udf_file_entry(tmp_path):
+    indir = tmp_path / 'udfzerofileentry'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
@@ -2996,8 +3181,9 @@
 
     iso.close()
 
-def test_hybrid_udf_get_from_iso_zero_udf_file_entry(tmpdir):
-    indir = tmpdir.mkdir('udfzerofileentry')
+def test_hybrid_udf_get_from_iso_zero_udf_file_entry(tmp_path):
+    indir = tmp_path / 'udfzerofileentry'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
@@ -3022,8 +3208,9 @@
 
     iso.close()
 
-def test_hybrid_boot_record_retain_system_use(tmpdir):
-    indir = tmpdir.mkdir('bootrecordretainsystemuse')
+def test_hybrid_boot_record_retain_system_use(tmp_path):
+    indir = tmp_path / 'bootrecordretainsystemuse'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
--- a/tests/integration/test_new.py
+++ b/tests/integration/test_new.py
@@ -18,8 +18,8 @@
 
 from test_common import *
 
-def do_a_test(iso, check_func, tmpdir=None):
-    if tmpdir is None:
+def do_a_test(iso, check_func, tmp_path=None):
+    if tmp_path is None:
         out = BytesIO()
 
         def do_getlen(obj):
@@ -28,7 +28,7 @@
         def do_sync(obj):
             pass
     else:
-        out = open(os.path.join(str(tmpdir), check_func.__name__), 'w+b')
+        out = open(os.path.join(str(tmp_path), check_func.__name__), 'w+b')
 
         def do_getlen(obj):
             return os.fstat(out.fileno()).st_size
@@ -1518,13 +1518,13 @@
         iso.add_eltorito('/ISOLINUX.BIN;1', '/BOOT.CAT;1', boot_load_size=4)
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_new_add_file(tmpdir):
+def test_new_add_file(tmp_path):
     # Now open up the ISO with pycdlib and check some things out.
     iso = pycdlib.PyCdlib()
     iso.new()
     # Add a new file.
 
-    testout = tmpdir.join('writetest.iso')
+    testout = tmp_path / 'writetest.iso'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -1534,7 +1534,7 @@
 
     iso.close()
 
-def test_new_add_file_twoleveldeep(tmpdir):
+def test_new_add_file_twoleveldeep(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
     iso.new()
@@ -1542,7 +1542,7 @@
     # Add new directory.
     iso.add_directory('/DIR1')
     iso.add_directory('/DIR1/SUBDIR1')
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
     iso.add_file(str(testout), '/DIR1/SUBDIR1/FOO.;1')
@@ -1585,23 +1585,23 @@
 
     iso.close()
 
-def test_new_add_file_no_rr_name(tmpdir):
+def test_new_add_file_no_rr_name(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
     iso.new(rock_ridge='1.09')
 
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
     with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
         iso.add_file(str(testout), '/FOO.;1')
     assert(str(excinfo.value) == 'Rock Ridge name must be supplied for a Rock Ridge new path')
 
-def test_new_add_file_not_initialized(tmpdir):
+def test_new_add_file_not_initialized(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
 
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
     with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
@@ -1856,24 +1856,24 @@
         iso.add_directory('/'+'a'*208)
     assert(str(excinfo.value) == 'ISO9660 directory names at interchange level 3 cannot exceed 207 characters')
 
-def test_new_rr_invalid_name(tmpdir):
+def test_new_rr_invalid_name(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
     iso.new(rock_ridge='1.09')
 
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
     with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
         iso.add_file(str(testout), '/FOO.;1', rr_name='foo/bar')
     assert(str(excinfo.value) == 'A rock ridge name must be relative')
 
-def test_new_hard_link_invalid_keyword(tmpdir):
+def test_new_hard_link_invalid_keyword(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
     iso.new()
 
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -1894,12 +1894,12 @@
         iso.add_hard_link(boot_catalog_old=True)
     assert(str(excinfo.value) == 'Attempting to make link to non-existent El Torito boot catalog')
 
-def test_new_hard_link_no_old_kw(tmpdir):
+def test_new_hard_link_no_old_kw(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
     iso.new()
 
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -1908,12 +1908,12 @@
         iso.add_hard_link(iso_new_path='/FOO.;1')
     assert(str(excinfo.value) == 'Exactly one old path must be specified')
 
-def test_new_hard_link_no_new_kw(tmpdir):
+def test_new_hard_link_no_new_kw(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
     iso.new()
 
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -1922,12 +1922,12 @@
         iso.add_hard_link(iso_old_path='/FOO.;1')
     assert(str(excinfo.value) == 'Exactly one new path must be specified')
 
-def test_new_hard_link_new_missing_rr(tmpdir):
+def test_new_hard_link_new_missing_rr(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
     iso.new(rock_ridge='1.09')
 
-    testout = tmpdir.join('foo')
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -2152,9 +2152,9 @@
 
     iso.close()
 
-def test_new_eltorito_boot_table_invalid_out(tmpdir):
-    testboot = tmpdir.join('boot')
-    testout = tmpdir.join('boot.out')
+def test_new_eltorito_boot_table_invalid_out(tmp_path):
+    testboot = tmp_path / 'boot'
+    testout = tmp_path / 'boot.out'
 
     iso = pycdlib.PyCdlib()
     iso.new(interchange_level=4)
@@ -3351,14 +3351,14 @@
 
     iso.close()
 
-def test_new_write_fp_not_binary(tmpdir):
+def test_new_write_fp_not_binary(tmp_path):
     # Create a new ISO.
     iso = pycdlib.PyCdlib()
 
     iso.new()
 
     with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
-        with open(os.path.join(str(tmpdir), 'out.iso'), 'w') as outfp:
+        with open(os.path.join(str(tmp_path), 'out.iso'), 'w') as outfp:
             iso.write_fp(outfp)
     assert(str(excinfo.value) == "The file to write out must be in binary mode (add 'b' to the open flags)")
 
@@ -4330,8 +4330,9 @@
     iso.close()
 
 @pytest.mark.slow
-def test_new_very_largefile(tmpdir):
-    indir = tmpdir.mkdir('verylarge')
+def test_new_very_largefile(tmp_path):
+    indir = tmp_path / 'verylarge'
+    indir.mkdir()
     largefile = os.path.join(str(indir), 'bigfile')
 
     with open(largefile, 'w') as outfp:
@@ -4354,15 +4355,16 @@
     assert(full_path is not None)
     assert(num_children == 3)
 
-    do_a_test(iso, check_very_largefile, tmpdir)
+    do_a_test(iso, check_very_largefile, tmp_path)
 
     iso.close()
 
 @pytest.mark.slow
-def test_new_six_gb_file(tmpdir):
+def test_new_six_gb_file(tmp_path):
     # An issue was found where any files larger than 6442444800 bytes couldn't
     # be extracted with pycdlib.  This test ensures that that continues to work.
-    indir = tmpdir.mkdir('sixgb')
+    indir = tmp_path / 'sixgb'
+    indir.mkdir()
     largefile = os.path.join(str(indir), 'bigfile')
     output_iso = os.path.join(str(indir), 'sixgb.iso')
     testfile = os.path.join(str(indir), 'testfile')
@@ -4385,8 +4387,9 @@
     assert(st.st_size == 6442444801)
 
 @pytest.mark.slow
-def test_new_rm_very_largefile(tmpdir):
-    indir = tmpdir.mkdir('rmverylarge')
+def test_new_rm_very_largefile(tmp_path):
+    indir = tmp_path / 'rmverylarge'
+    indir.mkdir()
     largefile = os.path.join(str(indir), 'bigfile')
 
     with open(largefile, 'w') as outfp:
@@ -4400,13 +4403,14 @@
 
     iso.rm_file('/BIGFILE.;1')
 
-    do_a_test(iso, check_nofiles, tmpdir)
+    do_a_test(iso, check_nofiles, tmp_path)
 
     iso.close()
 
 @pytest.mark.slow
-def test_new_udf_very_large(tmpdir):
-    indir = tmpdir.mkdir('udfverylarge')
+def test_new_udf_very_large(tmp_path):
+    indir = tmp_path / 'udfverylarge'
+    indir.mkdir()
     largefile = os.path.join(str(indir), 'foo')
 
     with open(largefile, 'wb') as outfp:
@@ -4418,7 +4422,7 @@
     # Add a new file.
     iso.add_file(largefile, '/FOO.;1', udf_path='/foo')
 
-    do_a_test(iso, check_udf_very_large, tmpdir)
+    do_a_test(iso, check_udf_very_large, tmp_path)
 
     iso.close()
 
@@ -6590,8 +6594,9 @@
     iso.close()
 
 @pytest.mark.slow
-def test_new_isolevel1_largefile(tmpdir):
-    indir = tmpdir.mkdir('verylarge')
+def test_new_isolevel1_largefile(tmp_path):
+    indir = tmp_path / 'verylarge'
+    indir.mkdir()
     largefile = os.path.join(str(indir), 'bigfile')
 
     with open(largefile, 'w') as outfp:
--- a/tests/integration/test_parse.py
+++ b/tests/integration/test_parse.py
@@ -12,8 +12,8 @@
 
 from test_common import *
 
-def do_a_test(tmpdir, outfile, check_func):
-    testout = tmpdir.join('writetest.iso')
+def do_a_test(tmp_path, outfile, check_func):
+    testout = tmp_path / 'writetest.iso'
 
     # Now open up the ISO with pycdlib and check some things out.
     iso = pycdlib.PyCdlib()
@@ -30,44 +30,49 @@
     check_func(iso2, os.stat(str(outfile)).st_size)
     iso2.close()
 
-def test_parse_invalid_file(tmpdir):
+def test_parse_invalid_file(tmp_path):
     iso = pycdlib.PyCdlib()
     with pytest.raises(TypeError):
         iso.open(None)
 
-def test_parse_nofiles(tmpdir):
+def test_parse_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('nofiles')
+    indir = tmp_path / 'nofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_nofiles)
+    do_a_test(tmp_path, outfile, check_nofiles)
 
-def test_parse_onefile(tmpdir):
+def test_parse_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_onefile)
+    do_a_test(tmp_path, outfile, check_onefile)
 
-def test_parse_onedir(tmpdir):
+def test_parse_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onedir')
+    indir = tmp_path / 'onedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_onedir)
+    do_a_test(tmp_path, outfile, check_onedir)
 
-def test_parse_twofiles(tmpdir):
+def test_parse_twofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -76,84 +81,98 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_twofiles)
+    do_a_test(tmp_path, outfile, check_twofiles)
 
-def test_parse_twodirs(tmpdir):
+def test_parse_twodirs(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefileonedir')
+    indir = tmp_path / 'onefileonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('bb')
-    indir.mkdir('aa')
+    newdir = indir / 'bb'
+    newdir.mkdir()
+    newdir = indir / 'aa'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_twodirs)
+    do_a_test(tmp_path, outfile, check_twodirs)
 
-def test_parse_onefileonedir(tmpdir):
+def test_parse_onefileonedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefileonedir')
+    indir = tmp_path / 'onefileonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_onefileonedir)
+    do_a_test(tmp_path, outfile, check_onefileonedir)
 
-def test_parse_onefile_onedirwithfile(tmpdir):
+def test_parse_onefile_onedirwithfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefileonedirwithfile')
+    indir = tmp_path / 'onefileonedirwithfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'bar'), 'wb') as outfp:
         outfp.write(b'bar\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_onefile_onedirwithfile)
+    do_a_test(tmp_path, outfile, check_onefile_onedirwithfile)
 
-def test_parse_tendirs(tmpdir):
+def test_parse_tendirs(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('tendirs')
+    indir = tmp_path / 'tendirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 10
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_tendirs)
+    do_a_test(tmp_path, outfile, check_tendirs)
 
-def test_parse_dirs_overflow_ptr_extent(tmpdir):
+def test_parse_dirs_overflow_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('manydirs')
+    indir = tmp_path / 'manydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 295
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_dirs_overflow_ptr_extent)
+    do_a_test(tmp_path, outfile, check_dirs_overflow_ptr_extent)
 
-def test_parse_dirs_just_short_ptr_extent(tmpdir):
+def test_parse_dirs_just_short_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('manydirs')
+    indir = tmp_path / 'manydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 293
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_dirs_just_short_ptr_extent)
+    do_a_test(tmp_path, outfile, check_dirs_just_short_ptr_extent)
 
-def test_parse_twoextentfile(tmpdir):
+def test_parse_twoextentfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('bigfile')
+    indir = tmp_path / 'bigfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     outstr = b''
     for j in range(0, 8):
@@ -165,79 +184,92 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    testout = tmpdir.join('writetest.iso')
+    testout = tmp_path / 'writetest.iso'
 
-    do_a_test(tmpdir, outfile, check_twoextentfile)
+    do_a_test(tmp_path, outfile, check_twoextentfile)
 
-def test_parse_twoleveldeepdir(tmpdir):
+def test_parse_twoleveldeepdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twoleveldeep')
+    indir = tmp_path / 'twoleveldeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
-    dir1.mkdir('subdir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
+    subdir = dir1 / 'subdir1'
+    subdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_twoleveldeepdir)
+    do_a_test(tmp_path, outfile, check_twoleveldeepdir)
 
-def test_parse_twoleveldeepfile(tmpdir):
+def test_parse_twoleveldeepfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twoleveldeepfile')
+    indir = tmp_path / 'twoleveldeepfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
-    subdir1 = dir1.mkdir('subdir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
+    subdir1 = dir1 / 'subdir1'
+    subdir1.mkdir()
     with open(os.path.join(str(subdir1), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_twoleveldeepfile)
+    do_a_test(tmp_path, outfile, check_twoleveldeepfile)
 
-def test_parse_joliet_nofiles(tmpdir):
+def test_parse_joliet_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('joliet')
+    indir = tmp_path / 'joliet'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_nofiles)
+    do_a_test(tmp_path, outfile, check_joliet_nofiles)
 
-def test_parse_joliet_onedir(tmpdir):
+def test_parse_joliet_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('joliet')
+    indir = tmp_path / 'joliet'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_onedir)
+    do_a_test(tmp_path, outfile, check_joliet_onedir)
 
-def test_parse_joliet_onefile(tmpdir):
+def test_parse_joliet_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietfile')
+    indir = tmp_path / 'jolietfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_onefile)
+    do_a_test(tmp_path, outfile, check_joliet_onefile)
 
-def test_parse_joliet_onefileonedir(tmpdir):
+def test_parse_joliet_onefileonedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietfile')
+    indir = tmp_path / 'jolietfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_onefileonedir)
+    do_a_test(tmp_path, outfile, check_joliet_onefileonedir)
 
-def test_parse_eltorito_nofiles(tmpdir):
+def test_parse_eltorito_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -245,11 +277,12 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_nofiles)
+    do_a_test(tmp_path, outfile, check_eltorito_nofiles)
 
-def test_parse_eltorito_twofile(tmpdir):
+def test_parse_eltorito_twofile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritotwofile')
+    indir = tmp_path / 'eltoritotwofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -259,31 +292,34 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_twofile)
+    do_a_test(tmp_path, outfile, check_eltorito_twofile)
 
-def test_parse_rr_nofiles(tmpdir):
+def test_parse_rr_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrnofiles')
+    indir = tmp_path / 'rrnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_nofiles)
+    do_a_test(tmp_path, outfile, check_rr_nofiles)
 
-def test_parse_rr_onefile(tmpdir):
+def test_parse_rr_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rronefile')
+    indir = tmp_path / 'rronefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_onefile)
+    do_a_test(tmp_path, outfile, check_rr_onefile)
 
-def test_parse_rr_twofile(tmpdir):
+def test_parse_rr_twofile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrtwofile')
+    indir = tmp_path / 'rrtwofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -292,37 +328,42 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_twofile)
+    do_a_test(tmp_path, outfile, check_rr_twofile)
 
-def test_parse_rr_onefileonedir(tmpdir):
+def test_parse_rr_onefileonedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rronefileonedir')
+    indir = tmp_path / 'rronefileonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_onefileonedir)
+    do_a_test(tmp_path, outfile, check_rr_onefileonedir)
 
-def test_parse_rr_onefileonedirwithfile(tmpdir):
+def test_parse_rr_onefileonedirwithfile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rronefileonedirwithfile')
+    indir = tmp_path / 'rronefileonedirwithfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'bar'), 'wb') as outfp:
         outfp.write(b'bar\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_onefileonedirwithfile)
+    do_a_test(tmp_path, outfile, check_rr_onefileonedirwithfile)
 
-def test_parse_rr_symlink(tmpdir):
+def test_parse_rr_symlink(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrsymlink')
+    indir = tmp_path / 'rrsymlink'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -333,13 +374,15 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_symlink)
+    do_a_test(tmp_path, outfile, check_rr_symlink)
 
-def test_parse_rr_symlink2(tmpdir):
+def test_parse_rr_symlink2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrsymlink2')
+    indir = tmp_path / 'rrsymlink2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     pwd = os.getcwd()
@@ -349,11 +392,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_symlink2)
+    do_a_test(tmp_path, outfile, check_rr_symlink2)
 
-def test_parse_rr_symlink_dot(tmpdir):
+def test_parse_rr_symlink_dot(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrsymlinkdot')
+    indir = tmp_path / 'rrsymlinkdot'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     pwd = os.getcwd()
     os.chdir(str(indir))
@@ -362,11 +406,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_symlink_dot)
+    do_a_test(tmp_path, outfile, check_rr_symlink_dot)
 
-def test_parse_rr_symlink_dotdot(tmpdir):
+def test_parse_rr_symlink_dotdot(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrsymlinkdotdot')
+    indir = tmp_path / 'rrsymlinkdotdot'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     pwd = os.getcwd()
     os.chdir(str(indir))
@@ -375,11 +420,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_symlink_dotdot)
+    do_a_test(tmp_path, outfile, check_rr_symlink_dotdot)
 
-def test_parse_rr_symlink_broken(tmpdir):
+def test_parse_rr_symlink_broken(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrsymlinkbroken')
+    indir = tmp_path / 'rrsymlinkbroken'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     pwd = os.getcwd()
     os.chdir(str(indir))
@@ -388,16 +434,19 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_symlink_broken)
+    do_a_test(tmp_path, outfile, check_rr_symlink_broken)
 
-def test_parse_alternating_subdir(tmpdir):
+def test_parse_alternating_subdir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('alternating')
+    indir = tmp_path / 'alternating'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'bb'), 'wb') as outfp:
         outfp.write(b'bb\n')
-    cc = indir.mkdir('cc')
-    aa = indir.mkdir('aa')
+    cc = newdir = indir / 'cc'
+    newdir.mkdir()
+    aa = newdir = indir / 'aa'
+    newdir.mkdir()
     with open(os.path.join(str(indir), 'dd'), 'wb') as outfp:
         outfp.write(b'dd\n')
     with open(os.path.join(str(cc), 'sub2'), 'wb') as outfp:
@@ -407,33 +456,36 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_alternating_subdir)
+    do_a_test(tmp_path, outfile, check_alternating_subdir)
 
-def test_parse_rr_verylongname(tmpdir):
+def test_parse_rr_verylongname(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrverylongname')
+    indir = tmp_path / 'rrverylongname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'a'*RR_MAX_FILENAME_LENGTH), 'wb') as outfp:
         outfp.write(b'aa\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_verylongname)
+    do_a_test(tmp_path, outfile, check_rr_verylongname)
 
-def test_parse_rr_verylongname_joliet(tmpdir):
+def test_parse_rr_verylongname_joliet(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrverylongname')
+    indir = tmp_path / 'rrverylongname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'a'*RR_MAX_FILENAME_LENGTH), 'wb') as outfp:
         outfp.write(b'aa\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_verylongname_joliet)
+    do_a_test(tmp_path, outfile, check_rr_verylongname_joliet)
 
-def test_parse_rr_manylongname(tmpdir):
+def test_parse_rr_manylongname(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrmanylongname')
+    indir = tmp_path / 'rrmanylongname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'a'*RR_MAX_FILENAME_LENGTH), 'wb') as outfp:
         outfp.write(b'aa\n')
@@ -452,11 +504,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_manylongname)
+    do_a_test(tmp_path, outfile, check_rr_manylongname)
 
-def test_parse_rr_manylongname2(tmpdir):
+def test_parse_rr_manylongname2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrmanylongname2')
+    indir = tmp_path / 'rrmanylongname2'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'a'*RR_MAX_FILENAME_LENGTH), 'wb') as outfp:
         outfp.write(b'aa\n')
@@ -477,41 +530,46 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_manylongname2)
+    do_a_test(tmp_path, outfile, check_rr_manylongname2)
 
-def test_parse_joliet_and_rr_nofiles(tmpdir):
+def test_parse_joliet_and_rr_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietandrrnofiles')
+    indir = tmp_path / 'jolietandrrnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_rr_nofiles)
+    do_a_test(tmp_path, outfile, check_joliet_and_rr_nofiles)
 
-def test_parse_joliet_and_rr_onefile(tmpdir):
+def test_parse_joliet_and_rr_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietandrronefile')
+    indir = tmp_path / 'jolietandrronefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_rr_onefile)
+    do_a_test(tmp_path, outfile, check_joliet_and_rr_onefile)
 
-def test_parse_joliet_and_rr_onedir(tmpdir):
+def test_parse_joliet_and_rr_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietandrronedir')
+    indir = tmp_path / 'jolietandrronedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_rr_onedir)
+    do_a_test(tmp_path, outfile, check_joliet_and_rr_onedir)
 
-def test_parse_rr_and_eltorito_nofiles(tmpdir):
+def test_parse_rr_and_eltorito_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrandeltoritonofiles')
+    indir = tmp_path / 'rrandeltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -519,11 +577,12 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_and_eltorito_nofiles)
+    do_a_test(tmp_path, outfile, check_rr_and_eltorito_nofiles)
 
-def test_parse_rr_and_eltorito_onefile(tmpdir):
+def test_parse_rr_and_eltorito_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrandeltoritoonefile')
+    indir = tmp_path / 'rrandeltoritoonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -533,24 +592,27 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_and_eltorito_onefile)
+    do_a_test(tmp_path, outfile, check_rr_and_eltorito_onefile)
 
-def test_parse_rr_and_eltorito_onedir(tmpdir):
+def test_parse_rr_and_eltorito_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrandeltoritoonedir')
+    indir = tmp_path / 'rrandeltoritoonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_and_eltorito_onedir)
+    do_a_test(tmp_path, outfile, check_rr_and_eltorito_onedir)
 
-def test_parse_joliet_and_eltorito_nofiles(tmpdir):
+def test_parse_joliet_and_eltorito_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietandeltoritonofiles')
+    indir = tmp_path / 'jolietandeltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -558,11 +620,12 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_eltorito_nofiles)
+    do_a_test(tmp_path, outfile, check_joliet_and_eltorito_nofiles)
 
-def test_parse_joliet_and_eltorito_onefile(tmpdir):
+def test_parse_joliet_and_eltorito_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietandeltoritoonefile')
+    indir = tmp_path / 'jolietandeltoritoonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -572,26 +635,29 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_eltorito_onefile)
+    do_a_test(tmp_path, outfile, check_joliet_and_eltorito_onefile)
 
-def test_parse_joliet_and_eltorito_onedir(tmpdir):
+def test_parse_joliet_and_eltorito_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietandeltoritoonedir')
+    indir = tmp_path / 'jolietandeltoritoonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_eltorito_onedir)
+    do_a_test(tmp_path, outfile, check_joliet_and_eltorito_onedir)
 
 @pytest.mark.skipif(find_executable('isohybrid') is None,
                     reason='syslinux not installed')
-def test_parse_isohybrid(tmpdir):
+def test_parse_isohybrid(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybrid')
+    indir = tmp_path / 'isohybrid'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'isolinux.bin'), 'wb') as outfp:
         outfp.seek(0x40)
@@ -602,13 +668,14 @@
                      '-o', str(outfile), str(indir)])
     subprocess.call(['isohybrid', '-v', str(outfile)])
 
-    do_a_test(tmpdir, outfile, check_isohybrid)
+    do_a_test(tmp_path, outfile, check_isohybrid)
 
 @pytest.mark.skipif(find_executable('isohybrid') is None,
                     reason='syslinux not installed')
-def test_parse_isohybrid_uefi(tmpdir):
+def test_parse_isohybrid_uefi(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybriduefi')
+    indir = tmp_path / 'isohybriduefi'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'isolinux.bin'), 'wb') as outfp:
         outfp.seek(0x40)
@@ -626,13 +693,14 @@
 
     subprocess.call(['isohybrid', '-u', '-v', str(outfile)])
 
-    do_a_test(tmpdir, outfile, check_isohybrid_uefi)
+    do_a_test(tmp_path, outfile, check_isohybrid_uefi)
 
 @pytest.mark.skipif(find_executable('isohybrid') is None,
                     reason='syslinux not installed')
-def test_parse_isohybrid_mac_uefi(tmpdir):
+def test_parse_isohybrid_mac_uefi(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybridmacuefi')
+    indir = tmp_path / 'isohybridmacuefi'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'isolinux.bin'), 'wb') as outfp:
         outfp.seek(0x40)
@@ -654,11 +722,12 @@
 
     subprocess.call(['isohybrid', '-u', '-m', '-v', str(outfile)])
 
-    do_a_test(tmpdir, outfile, check_isohybrid_mac_uefi)
+    do_a_test(tmp_path, outfile, check_isohybrid_mac_uefi)
 
-def test_parse_joliet_rr_and_eltorito_nofiles(tmpdir):
+def test_parse_joliet_rr_and_eltorito_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrrandeltoritonofiles')
+    indir = tmp_path / 'jolietrrandeltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -666,11 +735,12 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_rr_and_eltorito_nofiles)
+    do_a_test(tmp_path, outfile, check_joliet_rr_and_eltorito_nofiles)
 
-def test_parse_joliet_rr_and_eltorito_onefile(tmpdir):
+def test_parse_joliet_rr_and_eltorito_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrrandeltoritoonefile')
+    indir = tmp_path / 'jolietrrandeltoritoonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -680,161 +750,184 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_rr_and_eltorito_onefile)
+    do_a_test(tmp_path, outfile, check_joliet_rr_and_eltorito_onefile)
 
-def test_parse_joliet_rr_and_eltorito_onedir(tmpdir):
+def test_parse_joliet_rr_and_eltorito_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietrrandeltoritoonedir')
+    indir = tmp_path / 'jolietrrandeltoritoonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-J', '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_rr_and_eltorito_onedir)
+    do_a_test(tmp_path, outfile, check_joliet_rr_and_eltorito_onedir)
 
-def test_parse_rr_deep_dir(tmpdir):
+def test_parse_rr_deep_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrdeep')
+    indir = tmp_path / 'rrdeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8'
+    newdir.mkdir(parents=True)
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_deep_dir)
+    do_a_test(tmp_path, outfile, check_rr_deep_dir)
 
-def test_parse_rr_deep(tmpdir):
+def test_parse_rr_deep(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrdeep')
+    indir = tmp_path / 'rrdeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8'
+    newdir.mkdir(parents=True)
     with open(os.path.join(str(indir), 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', 'dir6', 'dir7', 'dir8', 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_deep)
+    do_a_test(tmp_path, outfile, check_rr_deep)
 
-def test_parse_rr_deep2(tmpdir):
+def test_parse_rr_deep2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrdeep')
+    indir = tmp_path / 'rrdeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8').mkdir('dir9')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8' / 'dir9'
+    newdir.mkdir(parents=True)
     with open(os.path.join(str(indir), 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', 'dir6', 'dir7', 'dir8', 'dir9', 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_deep2)
+    do_a_test(tmp_path, outfile, check_rr_deep2)
 
-def test_parse_xa_nofiles(tmpdir):
+def test_parse_xa_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xa')
+    indir = tmp_path / 'xa'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_xa_nofiles)
+    do_a_test(tmp_path, outfile, check_xa_nofiles)
 
-def test_parse_xa_onefile(tmpdir):
+def test_parse_xa_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xa')
+    indir = tmp_path / 'xa'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_xa_onefile)
+    do_a_test(tmp_path, outfile, check_xa_onefile)
 
-def test_parse_xa_onedir(tmpdir):
+def test_parse_xa_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xa')
+    indir = tmp_path / 'xa'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_xa_onedir)
+    do_a_test(tmp_path, outfile, check_xa_onedir)
 
-def test_parse_sevendeepdirs(tmpdir):
+def test_parse_sevendeepdirs(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('sevendeepdirs')
+    indir = tmp_path / 'sevendeepdirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 7
     x = indir
     for i in range(1, 1+numdirs):
-        x = x.mkdir('dir%d' % i)
+        x = x / ('dir%d' % i)
+        x.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_sevendeepdirs)
+    do_a_test(tmp_path, outfile, check_sevendeepdirs)
 
-def test_parse_xa_joliet_nofiles(tmpdir):
+def test_parse_xa_joliet_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xajoliet')
+    indir = tmp_path / 'xajoliet'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_xa_joliet_nofiles)
+    do_a_test(tmp_path, outfile, check_xa_joliet_nofiles)
 
-def test_parse_xa_joliet_onefile(tmpdir):
+def test_parse_xa_joliet_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xajolietonefile')
+    indir = tmp_path / 'xajolietonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_xa_joliet_onefile)
+    do_a_test(tmp_path, outfile, check_xa_joliet_onefile)
 
-def test_parse_xa_joliet_onedir(tmpdir):
+def test_parse_xa_joliet_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xajolietonefile')
+    indir = tmp_path / 'xajolietonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_xa_joliet_onedir)
+    do_a_test(tmp_path, outfile, check_xa_joliet_onedir)
 
-def test_parse_iso_level4_nofiles(tmpdir):
+def test_parse_iso_level4_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isolevel4nofiles')
+    indir = tmp_path / 'isolevel4nofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_isolevel4_nofiles)
+    do_a_test(tmp_path, outfile, check_isolevel4_nofiles)
 
-def test_parse_iso_level4_onefile(tmpdir):
+def test_parse_iso_level4_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isolevel4onefile')
+    indir = tmp_path / 'isolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_isolevel4_onefile)
+    do_a_test(tmp_path, outfile, check_isolevel4_onefile)
 
-def test_parse_iso_level4_onedir(tmpdir):
+def test_parse_iso_level4_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isolevel4onedir')
+    indir = tmp_path / 'isolevel4onedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_isolevel4_onedir)
+    do_a_test(tmp_path, outfile, check_isolevel4_onedir)
 
-def test_parse_iso_level4_eltorito(tmpdir):
+def test_parse_iso_level4_eltorito(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isolevel4eltorito')
+    indir = tmp_path / 'isolevel4eltorito'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -842,13 +935,15 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_isolevel4_eltorito)
+    do_a_test(tmp_path, outfile, check_isolevel4_eltorito)
 
-def test_parse_everything(tmpdir):
+def test_parse_everything(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('everything')
+    indir = tmp_path / 'everything'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8'
+    newdir.mkdir(parents=True)
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
@@ -865,41 +960,46 @@
                      '-J', '-rational-rock', '-xa', '-boot-info-table',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_everything)
+    do_a_test(tmp_path, outfile, check_everything)
 
-def test_parse_rr_xa_nofiles(tmpdir):
+def test_parse_rr_xa_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarrnofiles')
+    indir = tmp_path / 'xarrnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_xa_nofiles)
+    do_a_test(tmp_path, outfile, check_rr_xa_nofiles)
 
-def test_parse_rr_xa_onefile(tmpdir):
+def test_parse_rr_xa_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarronefile')
+    indir = tmp_path / 'xarronefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_xa_onefile)
+    do_a_test(tmp_path, outfile, check_rr_xa_onefile)
 
-def test_parse_rr_xa_onedir(tmpdir):
+def test_parse_rr_xa_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('xarronefile')
+    indir = tmp_path / 'xarronefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-xa', '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_xa_onedir)
+    do_a_test(tmp_path, outfile, check_rr_xa_onedir)
 
-def test_parse_rr_joliet_symlink(tmpdir):
+def test_parse_rr_joliet_symlink(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrsymlinkbroken')
+    indir = tmp_path / 'rrsymlinkbroken'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -910,21 +1010,24 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_joliet_symlink)
+    do_a_test(tmp_path, outfile, check_rr_joliet_symlink)
 
-def test_parse_rr_joliet_deep(tmpdir):
+def test_parse_rr_joliet_deep(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrjolietdeep')
+    indir = tmp_path / 'rrjolietdeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8'
+    newdir.mkdir(parents=True)
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_joliet_deep)
+    do_a_test(tmp_path, outfile, check_rr_joliet_deep)
 
-def test_parse_eltorito_multi_boot(tmpdir):
+def test_parse_eltorito_multi_boot(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('multiboot')
+    indir = tmp_path / 'multiboot'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -935,11 +1038,12 @@
                      '-eltorito-alt-boot', '-b', 'boot2', '-no-emul-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_multi_boot)
+    do_a_test(tmp_path, outfile, check_eltorito_multi_boot)
 
-def test_parse_eltorito_boot_table(tmpdir):
+def test_parse_eltorito_boot_table(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('boottable')
+    indir = tmp_path / 'boottable'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -947,11 +1051,12 @@
                      '-b', 'boot', '-c', 'boot.cat', '-no-emul-boot',
                      '-boot-info-table', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_boot_info_table)
+    do_a_test(tmp_path, outfile, check_eltorito_boot_info_table)
 
-def test_parse_eltorito_boot_table_large(tmpdir):
+def test_parse_eltorito_boot_table_large(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('boottable')
+    indir = tmp_path / 'boottable'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot'*20)
@@ -959,24 +1064,27 @@
                      '-b', 'boot', '-c', 'boot.cat', '-no-emul-boot',
                      '-boot-info-table', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_boot_info_table_large)
+    do_a_test(tmp_path, outfile, check_eltorito_boot_info_table_large)
 
-def test_parse_hard_link(tmpdir):
+def test_parse_hard_link(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('boottable')
+    indir = tmp_path / 'boottable'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     os.link(os.path.join(str(indir), 'foo'), os.path.join(str(indir), str(dir1), 'foo'))
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_hard_link)
+    do_a_test(tmp_path, outfile, check_hard_link)
 
-def test_parse_open_twice(tmpdir):
+def test_parse_open_twice(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -992,9 +1100,10 @@
 
     iso.close()
 
-def test_parse_get_and_write_fp_not_initialized(tmpdir):
+def test_parse_get_and_write_fp_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1004,12 +1113,13 @@
     iso = pycdlib.PyCdlib()
 
     with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
-        iso.get_and_write_fp('/FOO.;1', open(os.path.join(str(tmpdir), 'bar'), 'w'))
+        iso.get_and_write_fp('/FOO.;1', open(os.path.join(str(tmp_path), 'bar'), 'w'))
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_parse_get_and_write_not_initialized(tmpdir):
+def test_parse_get_and_write_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1022,9 +1132,10 @@
         iso.get_and_write('/FOO.;1', 'foo')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_parse_write_not_initialized(tmpdir):
+def test_parse_write_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1037,7 +1148,7 @@
         iso.write('out.iso')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_parse_write_with_progress(tmpdir):
+def test_parse_write_with_progress(tmp_path):
     test_parse_write_with_progress.num_progress_calls = 0
     test_parse_write_with_progress.done = 0
     def _progress(done, total):
@@ -1046,7 +1157,8 @@
         test_parse_write_with_progress.done = done
 
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1058,21 +1170,22 @@
 
     iso = pycdlib.PyCdlib()
     iso.open(str(outfile))
-    iso.write(str(tmpdir.join('writetest.iso')), progress_cb=_progress)
+    iso.write(str(tmp_path / 'writetest.iso'), progress_cb=_progress)
 
     assert(test_parse_write_with_progress.num_progress_calls == 14)
     assert(test_parse_write_with_progress.done == 73728)
 
     iso.close()
 
-def test_parse_write_with_progress_three_arg(tmpdir):
+def test_parse_write_with_progress_three_arg(tmp_path):
     def _progress(done, total, opaque):
         assert(total == 73728)
         opaque['num_calls'] += 1
         opaque['done'] = done
 
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1085,16 +1198,17 @@
     iso = pycdlib.PyCdlib()
     iso.open(str(outfile))
     collect = {'num_calls': 0, 'done': 0}
-    iso.write(str(tmpdir.join('writetest.iso')), progress_cb=_progress, progress_opaque=collect)
+    iso.write(str(tmp_path / 'writetest.iso'), progress_cb=_progress, progress_opaque=collect)
 
     assert(collect['num_calls'] == 14)
     assert(collect['done'] == 73728)
 
     iso.close()
 
-def test_parse_get_entry(tmpdir):
+def test_parse_get_entry(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1117,9 +1231,10 @@
 
     iso.close()
 
-def test_parse_get_entry_not_initialized(tmpdir):
+def test_parse_get_entry_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1133,11 +1248,13 @@
         fooentry = iso.get_entry('/FOO.;1')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_parse_list_dir(tmpdir):
+def test_parse_list_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'bar'), 'wb') as outfp:
         outfp.write(b'bar\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
@@ -1152,11 +1269,13 @@
 
     iso.close()
 
-def test_parse_list_dir_not_initialized(tmpdir):
+def test_parse_list_dir_not_initialized(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'bar'), 'wb') as outfp:
         outfp.write(b'bar\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
@@ -1170,9 +1289,10 @@
             pass
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_parse_list_dir_not_dir(tmpdir):
+def test_parse_list_dir_not_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('twofile')
+    indir = tmp_path / 'twofile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1191,9 +1311,10 @@
 
     iso.close()
 
-def test_parse_get_and_write(tmpdir):
+def test_parse_get_and_write(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'f\n')
@@ -1211,9 +1332,10 @@
     with open(foofile, 'r') as infp:
         assert(infp.read() == 'f\n')
 
-def test_parse_open_fp_twice(tmpdir):
+def test_parse_open_fp_twice(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1229,9 +1351,10 @@
             iso.open_fp(infp)
     assert(str(excinfo.value) == 'This object already has an ISO; either close it or create a new object')
 
-def test_parse_open_invalid_vd(tmpdir):
+def test_parse_open_invalid_vd(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1250,35 +1373,43 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Valid ISO9660 filesystems must have at least one PVD')
 
-def test_parse_same_dirname_different_parent(tmpdir):
+def test_parse_same_dirname_different_parent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('samedirnamedifferentparent')
+    indir = tmp_path / 'samedirnamedifferentparent'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
-    dir2 = indir.mkdir('dir2')
-    boot1 = dir1.mkdir('boot')
-    boot2 = dir2.mkdir('boot')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
+    dir2 = newdir = indir / 'dir2'
+    newdir.mkdir()
+    boot1 = dir1 / 'boot'
+    boot2 = dir2 / 'boot'
+    boot1.mkdir()
+    boot2.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-rational-rock',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_same_dirname_different_parent)
+    do_a_test(tmp_path, outfile, check_same_dirname_different_parent)
 
-def test_parse_joliet_iso_level_4(tmpdir):
+def test_parse_joliet_iso_level_4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietisolevel4')
+    indir = tmp_path / 'jolietisolevel4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_isolevel4)
+    do_a_test(tmp_path, outfile, check_joliet_isolevel4)
 
-def test_parse_eltorito_nofiles_hide(tmpdir):
+def test_parse_eltorito_nofiles_hide(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1287,11 +1418,12 @@
                      '-hide', 'boot.cat',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_nofiles_hide)
+    do_a_test(tmp_path, outfile, check_eltorito_nofiles_hide)
 
-def test_parse_eltorito_nofiles_hide_joliet(tmpdir):
+def test_parse_eltorito_nofiles_hide_joliet(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1300,11 +1432,12 @@
                      '-J', '-hide', 'boot.cat', '-hide-joliet', 'boot.cat',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_eltorito_nofiles_hide)
+    do_a_test(tmp_path, outfile, check_joliet_and_eltorito_nofiles_hide)
 
-def test_parse_eltorito_nofiles_hide_joliet_only(tmpdir):
+def test_parse_eltorito_nofiles_hide_joliet_only(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1313,11 +1446,12 @@
                      '-J', '-hide-joliet', 'boot.cat',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_eltorito_nofiles_hide_only)
+    do_a_test(tmp_path, outfile, check_joliet_and_eltorito_nofiles_hide_only)
 
-def test_parse_eltorito_nofiles_hide_iso_only_joliet(tmpdir):
+def test_parse_eltorito_nofiles_hide_iso_only_joliet(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1326,11 +1460,12 @@
                      '-J', '-hide', 'boot.cat',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_and_eltorito_nofiles_hide_iso_only)
+    do_a_test(tmp_path, outfile, check_joliet_and_eltorito_nofiles_hide_iso_only)
 
-def test_parse_hard_link_reshuffle(tmpdir):
+def test_parse_hard_link_reshuffle(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('boottable')
+    indir = tmp_path / 'boottable'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1338,11 +1473,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_hard_link_reshuffle)
+    do_a_test(tmp_path, outfile, check_hard_link_reshuffle)
 
-def test_parse_open_invalid_pvd_ident(tmpdir):
+def test_parse_open_invalid_pvd_ident(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1359,9 +1495,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Valid ISO9660 filesystems must have at least one PVD')
 
-def test_parse_open_invalid_pvd_version(tmpdir):
+def test_parse_open_invalid_pvd_version(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1378,9 +1515,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid volume descriptor version 2')
 
-def test_parse_open_invalid_pvd_unused1(tmpdir):
+def test_parse_open_invalid_pvd_unused1(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1397,9 +1535,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'PVD flags field is not zero')
 
-def test_parse_open_invalid_pvd_unused2(tmpdir):
+def test_parse_open_invalid_pvd_unused2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1416,9 +1555,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'data in 2nd unused field not zero')
 
-def test_parse_open_invalid_pvd_unused4(tmpdir):
+def test_parse_open_invalid_pvd_unused4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1435,9 +1575,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'data in 2nd unused field not zero')
 
-def test_parse_open_invalid_pvd_unused5(tmpdir):
+def test_parse_open_invalid_pvd_unused5(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1455,9 +1596,10 @@
     iso.open(str(outfile))
     iso.close()
 
-def test_parse_invalid_pvd_space_size_le_be_mismatch(tmpdir):
+def test_parse_invalid_pvd_space_size_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1474,9 +1616,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian space size disagree')
 
-def test_parse_invalid_pvd_set_size_le_be_mismatch(tmpdir):
+def test_parse_invalid_pvd_set_size_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1493,9 +1636,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian set size disagree')
 
-def test_parse_invalid_pvd_seqnum_le_be_mismatch(tmpdir):
+def test_parse_invalid_pvd_seqnum_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1512,9 +1656,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian seqnum disagree')
 
-def test_parse_invalid_pvd_lb_le_be_mismatch(tmpdir):
+def test_parse_invalid_pvd_lb_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1531,9 +1676,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian logical block size disagree')
 
-def test_parse_invalid_pvd_ptr_size_le_be_mismatch(tmpdir):
+def test_parse_invalid_pvd_ptr_size_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1550,9 +1696,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian path table size disagree')
 
-def test_parse_open_invalid_vdst_ident(tmpdir):
+def test_parse_open_invalid_vdst_ident(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1569,9 +1716,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Valid ISO9660 filesystems must have at least one Volume Descriptor Set Terminator')
 
-def test_parse_open_invalid_vdst_version(tmpdir):
+def test_parse_open_invalid_vdst_version(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1588,9 +1736,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid VDST version')
 
-def test_parse_invalid_br_ident(tmpdir):
+def test_parse_invalid_br_ident(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1614,9 +1763,10 @@
     # see that we didn't parse the VDST.
     assert(str(excinfo.value) == 'Valid ISO9660 filesystems must have at least one Volume Descriptor Set Terminator')
 
-def test_parse_invalid_br_version(tmpdir):
+def test_parse_invalid_br_version(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1636,9 +1786,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid boot record version')
 
-def test_parse_open_invalid_svd_ident(tmpdir):
+def test_parse_open_invalid_svd_ident(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1659,9 +1810,10 @@
     # see that we didn't parse the VDST.
     assert(str(excinfo.value) == 'Valid ISO9660 filesystems must have at least one Volume Descriptor Set Terminator')
 
-def test_parse_open_invalid_svd_version(tmpdir):
+def test_parse_open_invalid_svd_version(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1678,9 +1830,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid volume descriptor version 3')
 
-def test_parse_open_invalid_svd_unused1(tmpdir):
+def test_parse_open_invalid_svd_unused1(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1697,9 +1850,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'data in 2nd unused field not zero')
 
-def test_parse_open_invalid_svd_file_structure_version(tmpdir):
+def test_parse_open_invalid_svd_file_structure_version(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1716,9 +1870,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'File structure version expected to be 1')
 
-def test_parse_open_invalid_svd_unused2(tmpdir):
+def test_parse_open_invalid_svd_unused2(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1735,9 +1890,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'data in 2nd unused field not zero')
 
-def test_parse_invalid_svd_space_size_le_be_mismatch(tmpdir):
+def test_parse_invalid_svd_space_size_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1754,9 +1910,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian space size disagree')
 
-def test_parse_invalid_svd_set_size_le_be_mismatch(tmpdir):
+def test_parse_invalid_svd_set_size_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1773,9 +1930,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian set size disagree')
 
-def test_parse_invalid_svd_seqnum_le_be_mismatch(tmpdir):
+def test_parse_invalid_svd_seqnum_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1792,9 +1950,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian seqnum disagree')
 
-def test_parse_invalid_svd_lb_le_be_mismatch(tmpdir):
+def test_parse_invalid_svd_lb_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1811,9 +1970,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian logical block size disagree')
 
-def test_parse_invalid_svd_ptr_size_le_be_mismatch(tmpdir):
+def test_parse_invalid_svd_ptr_size_le_be_mismatch(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
@@ -1830,8 +1990,9 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian path table size disagree')
 
-def test_parse_iso_too_small(tmpdir):
-    indir = tmpdir.mkdir('isotoosmall')
+def test_parse_iso_too_small(tmp_path):
+    indir = tmp_path / 'isotoosmall'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(outfile, 'wb') as outfp:
         outfp.write(b'\x00'*16*2048)
@@ -1842,9 +2003,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Failed to read entire volume descriptor')
 
-def test_parse_eltorito_boot_table_odd(tmpdir):
+def test_parse_eltorito_boot_table_odd(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('boottable')
+    indir = tmp_path / 'boottable'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boo'*27)
@@ -1852,22 +2014,25 @@
                      '-b', 'boot', '-c', 'boot.cat', '-no-emul-boot',
                      '-boot-info-table', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_boot_info_table_large_odd)
+    do_a_test(tmp_path, outfile, check_eltorito_boot_info_table_large_odd)
 
-def test_parse_joliet_large_directory(tmpdir):
+def test_parse_joliet_large_directory(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietlargedirectory')
+    indir = tmp_path / 'jolietlargedirectory'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     for i in range(1, 50):
-        indir.mkdir('dir' + str(i))
+        newdir = indir / ('dir' + str(i))
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_large_directory)
+    do_a_test(tmp_path, outfile, check_joliet_large_directory)
 
-def test_parse_zero_byte_file(tmpdir):
+def test_parse_zero_byte_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('zerobytefile')
+    indir = tmp_path / 'zerobytefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         pass
@@ -1876,11 +2041,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_zero_byte_file)
+    do_a_test(tmp_path, outfile, check_zero_byte_file)
 
-def test_parse_dirrecord_too_short(tmpdir):
+def test_parse_dirrecord_too_short(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('tooshort')
+    indir = tmp_path / 'tooshort'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -1893,9 +2059,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid directory record')
 
-def test_parse_eltorito_hide_boot(tmpdir):
+def test_parse_eltorito_hide_boot(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritohideboot')
+    indir = tmp_path / 'eltoritohideboot'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1904,11 +2071,12 @@
                      '-hide', 'boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_hide_boot)
+    do_a_test(tmp_path, outfile, check_eltorito_hide_boot)
 
-def test_parse_get_entry_joliet(tmpdir):
+def test_parse_get_entry_joliet(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('getentryjoliet')
+    indir = tmp_path / 'getentryjoliet'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -1932,12 +2100,14 @@
 
     iso.close()
 
-def test_parse_dirrecord_nonzero_pad(tmpdir):
-    indir = tmpdir.mkdir('dirrecordnonzeropad')
+def test_parse_dirrecord_nonzero_pad(tmp_path):
+    indir = tmp_path / 'dirrecordnonzeropad'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
 
     for d in range(0, 53):
-        indir.mkdir('dir%d' % d)
+        newdir = indir / ('dir%d' % d)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
@@ -1950,9 +2120,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid padding on ISO')
 
-def test_parse_open_invalid_eltorito_header_id(tmpdir):
+def test_parse_open_invalid_eltorito_header_id(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1972,9 +2143,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'El Torito Validation entry header ID not 1')
 
-def test_parse_open_invalid_eltorito_platform_id(tmpdir):
+def test_parse_open_invalid_eltorito_platform_id(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -1994,9 +2166,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'El Torito Validation entry platform ID not valid')
 
-def test_parse_open_invalid_eltorito_first_key_byte(tmpdir):
+def test_parse_open_invalid_eltorito_first_key_byte(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2016,9 +2189,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'El Torito Validation entry first keybyte not 0x55')
 
-def test_parse_open_invalid_eltorito_second_key_byte(tmpdir):
+def test_parse_open_invalid_eltorito_second_key_byte(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2038,9 +2212,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'El Torito Validation entry second keybyte not 0xaa')
 
-def test_parse_open_invalid_eltorito_csum(tmpdir):
+def test_parse_open_invalid_eltorito_csum(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('modifyinplaceisolevel4onefile')
+    indir = tmp_path / 'modifyinplaceisolevel4onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2061,30 +2236,34 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'El Torito Validation entry checksum not correct')
 
-def test_parse_hidden_file(tmpdir):
+def test_parse_hidden_file(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'aaaaaaaa'), 'wb') as outfp:
         outfp.write(b'aa\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-hidden', 'aaaaaaaa', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_hidden_file)
+    do_a_test(tmp_path, outfile, check_hidden_file)
 
-def test_parse_hidden_dir(tmpdir):
+def test_parse_hidden_dir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onedir')
+    indir = tmp_path / 'onedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-hidden', 'dir1', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_hidden_dir)
+    do_a_test(tmp_path, outfile, check_hidden_dir)
 
-def test_parse_eltorito_bad_boot_indicator(tmpdir):
+def test_parse_eltorito_bad_boot_indicator(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2103,9 +2282,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid El Torito initial entry boot indicator')
 
-def test_parse_eltorito_bad_boot_media(tmpdir):
+def test_parse_eltorito_bad_boot_media(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2124,9 +2304,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Invalid El Torito boot media type')
 
-def test_parse_eltorito_bad_unused(tmpdir):
+def test_parse_eltorito_bad_unused(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2145,9 +2326,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'El Torito unused field must be 0')
 
-def test_parse_eltorito_hd_emul(tmpdir):
+def test_parse_eltorito_hd_emul(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'\x00'*446 + b'\x00\x01\x01\x00\x02\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00' + b'\x00'*16 + b'\x00'*16 + b'\x00'*16 + b'\x55' + b'\xaa')
@@ -2155,11 +2337,12 @@
                      '-c', 'boot.cat', '-b', 'boot', '-hard-disk-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_hd_emul)
+    do_a_test(tmp_path, outfile, check_eltorito_hd_emul)
 
-def test_parse_eltorito_hd_emul_not_bootable(tmpdir):
+def test_parse_eltorito_hd_emul_not_bootable(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'\x00'*446 + b'\x00\x01\x01\x00\x02\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00' + b'\x00'*16 + b'\x00'*16 + b'\x00'*16 + b'\x55' + b'\xaa')
@@ -2167,11 +2350,12 @@
                      '-c', 'boot.cat', '-b', 'boot', '-hard-disk-boot', '-no-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_hd_emul_not_bootable)
+    do_a_test(tmp_path, outfile, check_eltorito_hd_emul_not_bootable)
 
-def test_parse_eltorito_floppy12(tmpdir):
+def test_parse_eltorito_floppy12(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'\x00'*(2400*512))
@@ -2181,11 +2365,12 @@
                      '-c', 'boot.cat', '-b', 'boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_floppy12)
+    do_a_test(tmp_path, outfile, check_eltorito_floppy12)
 
-def test_parse_eltorito_floppy144(tmpdir):
+def test_parse_eltorito_floppy144(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'\x00'*(2880*512))
@@ -2195,11 +2380,12 @@
                      '-c', 'boot.cat', '-b', 'boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_floppy144)
+    do_a_test(tmp_path, outfile, check_eltorito_floppy144)
 
-def test_parse_eltorito_floppy288(tmpdir):
+def test_parse_eltorito_floppy288(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'\x00'*(5760*512))
@@ -2209,11 +2395,12 @@
                      '-c', 'boot.cat', '-b', 'boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_floppy288)
+    do_a_test(tmp_path, outfile, check_eltorito_floppy288)
 
-def test_parse_ptr_le_and_be_disagree(tmpdir):
+def test_parse_ptr_le_and_be_disagree(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -2230,9 +2417,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Little-endian and big-endian path table records do not agree')
 
-def test_parse_joliet_ptr_le_and_be_disagree(tmpdir):
+def test_parse_joliet_ptr_le_and_be_disagree(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-iso-level', '1', '-no-pad', '-J',
                      '-o', str(outfile), str(indir)])
@@ -2249,9 +2437,10 @@
         iso.open(str(outfile))
     assert(str(excinfo.value) == 'Joliet little-endian and big-endian path table records do not agree')
 
-def test_parse_add_file_with_semicolon(tmpdir):
+def test_parse_add_file_with_semicolon(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'FOO;1'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2263,13 +2452,14 @@
 
     iso.open(str(outfile))
 
-    do_a_test(tmpdir, outfile, check_onefile_with_semicolon)
+    do_a_test(tmp_path, outfile, check_onefile_with_semicolon)
 
     iso.close()
 
-def test_parse_bad_eltorito_ident(tmpdir):
+def test_parse_bad_eltorito_ident(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2282,18 +2472,22 @@
         outfp.seek(17*2048+7)
         outfp.write('Z')
 
-    do_a_test(tmpdir, outfile, check_bad_eltorito_ident)
+    do_a_test(tmp_path, outfile, check_bad_eltorito_ident)
 
-def test_parse_duplicate_rrmoved_name(tmpdir):
+def test_parse_duplicate_rrmoved_name(tmp_path):
     iso = pycdlib.PyCdlib()
     iso.new(rock_ridge='1.09')
 
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    fdir = indir.mkdir('A').mkdir('B').mkdir('C').mkdir('D').mkdir('E').mkdir('F')
-    fdir.mkdir('G').mkdir('1')
-    fdir.mkdir('H').mkdir('1')
+    fdir = indir / 'A' / 'B' / 'C' / 'D' / 'E' / 'F'
+    fdir.mkdir(parents=True)
+    newdir = fdir / 'G' / '1'
+    newdir.mkdir(parents=True)
+    newdir = fdir / 'H' / '1'
+    newdir.mkdir(parents=True)
     with open(os.path.join(str(indir), 'A', 'B', 'C', 'D', 'E', 'F', 'G', '1', 'first'), 'wb') as outfp:
         outfp.write(b'first\n')
     with open(os.path.join(str(indir), 'A', 'B', 'C', 'D', 'E', 'F', 'H', '1', 'second'), 'wb') as outfp:
@@ -2302,11 +2496,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_two_dirs_same_level)
+    do_a_test(tmp_path, outfile, check_rr_two_dirs_same_level)
 
-def test_parse_eltorito_rr_verylongname(tmpdir):
+def test_parse_eltorito_rr_verylongname(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrverylongname')
+    indir = tmp_path / 'rrverylongname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2314,13 +2509,14 @@
                      '-c', 'a'*RR_MAX_FILENAME_LENGTH, '-b', 'boot', '-no-emul-boot',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_rr_verylongname)
+    do_a_test(tmp_path, outfile, check_eltorito_rr_verylongname)
 
 @pytest.mark.skipif(find_executable('isohybrid') is None,
                     reason='syslinux not installed')
-def test_parse_isohybrid_file_before(tmpdir):
+def test_parse_isohybrid_file_before(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('isohybrid')
+    indir = tmp_path / 'isohybrid'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'isolinux.bin'), 'wb') as outfp:
         outfp.seek(0x40)
@@ -2333,11 +2529,12 @@
                      '-o', str(outfile), str(indir)])
     subprocess.call(['isohybrid', '-v', str(outfile)])
 
-    do_a_test(tmpdir, outfile, check_isohybrid_file_before)
+    do_a_test(tmp_path, outfile, check_isohybrid_file_before)
 
-def test_parse_eltorito_rr_joliet_verylongname(tmpdir):
+def test_parse_eltorito_rr_joliet_verylongname(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrjolietverylongname')
+    indir = tmp_path / 'rrjolietverylongname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -2345,80 +2542,92 @@
                      '-c', 'a'*RR_MAX_FILENAME_LENGTH, '-b', 'boot', '-no-emul-boot',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_rr_joliet_verylongname)
+    do_a_test(tmp_path, outfile, check_eltorito_rr_joliet_verylongname)
 
-def test_parse_joliet_dirs_overflow_ptr_extent(tmpdir):
+def test_parse_joliet_dirs_overflow_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietmanydirs')
+    indir = tmp_path / 'jolietmanydirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 216
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_dirs_overflow_ptr_extent)
+    do_a_test(tmp_path, outfile, check_joliet_dirs_overflow_ptr_extent)
 
-def test_parse_joliet_dirs_just_short_ptr_extent(tmpdir):
+def test_parse_joliet_dirs_just_short_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietjustshortdirs')
+    indir = tmp_path / 'jolietjustshortdirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 215
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_dirs_just_short_ptr_extent)
+    do_a_test(tmp_path, outfile, check_joliet_dirs_just_short_ptr_extent)
 
-def test_parse_joliet_dirs_add_ptr_extent(tmpdir):
+def test_parse_joliet_dirs_add_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietjustshortdirs')
+    indir = tmp_path / 'jolietjustshortdirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 295
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_dirs_add_ptr_extent)
+    do_a_test(tmp_path, outfile, check_joliet_dirs_add_ptr_extent)
 
-def test_parse_joliet_dirs_rm_ptr_extent(tmpdir):
+def test_parse_joliet_dirs_rm_ptr_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietjustshortdirs')
+    indir = tmp_path / 'jolietjustshortdirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 293
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_dirs_rm_ptr_extent)
+    do_a_test(tmp_path, outfile, check_joliet_dirs_rm_ptr_extent)
 
-def test_parse_long_directory_name(tmpdir):
+def test_parse_long_directory_name(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('longdirectoryname')
+    indir = tmp_path / 'longdirectoryname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('directory1')
+    newdir = indir / 'directory1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '3', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_long_directory_name)
+    do_a_test(tmp_path, outfile, check_long_directory_name)
 
-def test_parse_long_file_name(tmpdir):
+def test_parse_long_file_name(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('longdirectoryname')
+    indir = tmp_path / 'longdirectoryname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foobarbaz1'), 'wb') as outfp:
         outfp.write(b'foobarbaz1\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '3', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_long_file_name)
+    do_a_test(tmp_path, outfile, check_long_file_name)
 
-def test_parse_overflow_root_dir_record(tmpdir):
+def test_parse_overflow_root_dir_record(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('overflowrootdirrecord')
+    indir = tmp_path / 'overflowrootdirrecord'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     for letter in ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'o'):
         with open(os.path.join(str(indir), letter*20), 'wb') as outfp:
@@ -2426,26 +2635,34 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_overflow_root_dir_record)
+    do_a_test(tmp_path, outfile, check_overflow_root_dir_record)
 
-def test_parse_duplicate_deep_dir(tmpdir):
-    indir = tmpdir.mkdir('duplicatedeepdir')
-    outfile = str(indir)+'.iso'
-
-    get = indir.mkdir('books').mkdir('lkhg').mkdir('HyperNews').mkdir('get')
-    get.mkdir('fs').mkdir('fs').mkdir('1')
-    khg = get.mkdir('khg')
-    khg.mkdir('1')
-    khg.mkdir('117').mkdir('1').mkdir('1').mkdir('1').mkdir('1')
-    khg.mkdir('35').mkdir('1').mkdir('1')
+def test_parse_duplicate_deep_dir(tmp_path):
+    indir = tmp_path / 'duplicatedeepdir'
+    indir.mkdir()
+    outfile = str(indir)+'.iso'
+
+    get = indir / 'books' / 'lkhg' / 'HyperNews' / 'get'
+    get.mkdir(parents=True)
+    newdir = get / 'fs' / 'fs' / '1'
+    newdir.mkdir(parents=True)
+    khg = get / 'khg'
+    khg.mkdir()
+    newdir = khg / '1'
+    newdir.mkdir(parents=True)
+    newdir = khg / '117' / '1' / '1' / '1' / '1'
+    newdir.mkdir(parents=True)
+    newdir = khg / '35' / '1' / '1'
+    newdir.mkdir(parents=True)
 
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_duplicate_deep_dir)
+    do_a_test(tmp_path, outfile, check_duplicate_deep_dir)
 
-def test_parse_no_joliet_name(tmpdir):
-    indir = tmpdir.mkdir('nojolietname')
+def test_parse_no_joliet_name(tmp_path):
+    indir = tmp_path / 'nojolietname'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
@@ -2454,22 +2671,25 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-hide-joliet', 'foo', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_onefile_joliet_no_file)
+    do_a_test(tmp_path, outfile, check_onefile_joliet_no_file)
 
-def test_parse_joliet_isolevel4_nofiles(tmpdir):
-    indir = tmpdir.mkdir('jolietisolevel4nofiles')
+def test_parse_joliet_isolevel4_nofiles(tmp_path):
+    indir = tmp_path / 'jolietisolevel4nofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-J', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_isolevel4_nofiles)
+    do_a_test(tmp_path, outfile, check_joliet_isolevel4_nofiles)
 
-def test_parse_deep_rr_symlink(tmpdir):
+def test_parse_deep_rr_symlink(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('sevendeepdirs')
+    indir = tmp_path / 'sevendeepdirs'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    dir7 = indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7')
+    dir7 = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7'
+    dir7.mkdir(parents=True)
     pwd = os.getcwd()
     os.chdir(str(dir7))
     os.symlink('/usr/share/foo', 'sym')
@@ -2477,13 +2697,16 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_deep_rr_symlink)
+    do_a_test(tmp_path, outfile, check_deep_rr_symlink)
 
-def test_parse_rr_deep_weird_layout(tmpdir):
-    indir = tmpdir.mkdir('rrdeepweird')
+def test_parse_rr_deep_weird_layout(tmp_path):
+    indir = tmp_path / 'rrdeepweird'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
-    absimp = indir.mkdir('astroid').mkdir('astroid').mkdir('tests').mkdir('testdata').mkdir('python3').mkdir('data').mkdir('absimp')
-    sidepackage = absimp.mkdir('sidepackage')
+    absimp = indir / 'astroid' / 'astroid' / 'tests' / 'testdata' / 'python3' / 'data' / 'absimp'
+    absimp.mkdir(parents=True)
+    sidepackage = absimp / 'sidepackage'
+    sidepackage.mkdir()
     with open(os.path.join(str(absimp), 'string.py'), 'wb') as outfp:
         outfp.write(b'from __future__ import absolute_import, print_functino\nimport string\nprint(string)\n')
     with open(os.path.join(str(sidepackage), '__init__.py'), 'wb') as outfp:
@@ -2492,32 +2715,37 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_deep_weird_layout)
+    do_a_test(tmp_path, outfile, check_rr_deep_weird_layout)
 
-def test_parse_rr_long_dir_name(tmpdir):
-    indir = tmpdir.mkdir('rrlongdirname')
+def test_parse_rr_long_dir_name(tmp_path):
+    indir = tmp_path / 'rrlongdirname'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
-    indir.mkdir('a'*RR_MAX_FILENAME_LENGTH)
+    newdir = indir / ('a'*RR_MAX_FILENAME_LENGTH)
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_long_dir_name)
+    do_a_test(tmp_path, outfile, check_rr_long_dir_name)
 
-def test_parse_rr_hidden_relocated(tmpdir):
+def test_parse_rr_hidden_relocated(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrdeep')
+    indir = tmp_path / 'rrdeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7').mkdir('dir8').mkdir('dir9')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7' / 'dir8' / 'dir9'
+    newdir.mkdir(parents=True)
     with open(os.path.join(str(indir), 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', 'dir6', 'dir7', 'dir8', 'dir9', 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-rational-rock', '-hide-rr-moved', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_rr_relocated_hidden)
+    do_a_test(tmp_path, outfile, check_rr_relocated_hidden)
 
-def test_parse_open_fp_not_binary(tmpdir):
+def test_parse_open_fp_not_binary(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('rrdeep')
+    indir = tmp_path / 'rrdeep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
@@ -2529,9 +2757,10 @@
             iso.open_fp(infp)
     assert(str(excinfo.value) == "The file to open must be in binary mode (add 'b' to the open flags)")
 
-def test_parse_open_too_small_pvd(tmpdir):
+def test_parse_open_too_small_pvd(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('toosmallpvd')
+    indir = tmp_path / 'toosmallpvd'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2544,11 +2773,12 @@
         fp.seek(16*2048+0x50)
         fp.write(b'\x16\x00\x00\x00\x00\x00\x00\x16')
 
-    do_a_test(tmpdir, outfile, check_onefile)
+    do_a_test(tmp_path, outfile, check_onefile)
 
-def test_parse_open_too_small_joliet(tmpdir):
+def test_parse_open_too_small_joliet(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('toosmalljoliet')
+    indir = tmp_path / 'toosmalljoliet'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2561,11 +2791,12 @@
         fp.seek(16*2048+0x50)
         fp.write(b'\x16\x00\x00\x00\x00\x00\x00\x16')
 
-    do_a_test(tmpdir, outfile, check_joliet_onefile)
+    do_a_test(tmp_path, outfile, check_joliet_onefile)
 
-def test_parse_open_too_small_isolevel4(tmpdir):
+def test_parse_open_too_small_isolevel4(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('toosmallisolevel4')
+    indir = tmp_path / 'toosmallisolevel4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2578,11 +2809,12 @@
         fp.seek(16*2048+0x50)
         fp.write(b'\x16\x00\x00\x00\x00\x00\x00\x16')
 
-    do_a_test(tmpdir, outfile, check_isolevel4_onefile)
+    do_a_test(tmp_path, outfile, check_isolevel4_onefile)
 
-def test_parse_open_larger_than_iso(tmpdir):
+def test_parse_open_larger_than_iso(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('largerthaniso')
+    indir = tmp_path / 'largerthaniso'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2595,11 +2827,12 @@
         fp.seek(23*2048+0x4e)
         fp.write(b'\x01\x08\x00\x00\x00\x00\x08\x01')
 
-    do_a_test(tmpdir, outfile, check_onefile_toolong)
+    do_a_test(tmp_path, outfile, check_onefile_toolong)
 
-def test_parse_pvd_zero_datetime(tmpdir):
+def test_parse_pvd_zero_datetime(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('zerodatetimeiso')
+    indir = tmp_path / 'zerodatetimeiso'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-o', str(outfile), str(indir)])
@@ -2608,11 +2841,12 @@
         fp.seek(16*2048 + 813)
         fp.write(b'\x00'*17)
 
-    do_a_test(tmpdir, outfile, check_pvd_zero_datetime)
+    do_a_test(tmp_path, outfile, check_pvd_zero_datetime)
 
-def test_parse_pvd_zero_digit_datetime(tmpdir):
+def test_parse_pvd_zero_digit_datetime(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('zerodatetimeiso')
+    indir = tmp_path / 'zerodatetimeiso'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-o', str(outfile), str(indir)])
@@ -2621,11 +2855,12 @@
         fp.seek(16*2048 + 813)
         fp.write(b'0'*17)
 
-    do_a_test(tmpdir, outfile, check_pvd_zero_datetime)
+    do_a_test(tmp_path, outfile, check_pvd_zero_datetime)
 
-def test_parse_pvd_zero_digit_datetime_zero_tz(tmpdir):
+def test_parse_pvd_zero_digit_datetime_zero_tz(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('zerodatetimeiso')
+    indir = tmp_path / 'zerodatetimeiso'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-o', str(outfile), str(indir)])
@@ -2635,11 +2870,12 @@
         fp.write(b'0'*16)
         fp.write(b'\x00')
 
-    do_a_test(tmpdir, outfile, check_pvd_zero_datetime)
+    do_a_test(tmp_path, outfile, check_pvd_zero_datetime)
 
-def test_parse_pvd_invalid_year(tmpdir):
+def test_parse_pvd_invalid_year(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('zerodatetimeiso')
+    indir = tmp_path / 'zerodatetimeiso'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-o', str(outfile), str(indir)])
@@ -2648,10 +2884,11 @@
         fp.seek(16*2048 + 813)
         fp.write(b'0'*4)
 
-    do_a_test(tmpdir, outfile, check_pvd_zero_datetime)
+    do_a_test(tmp_path, outfile, check_pvd_zero_datetime)
 
-def test_parse_bad_root_dir_ident(tmpdir):
-    indir = tmpdir.mkdir('badrootdirident')
+def test_parse_bad_root_dir_ident(tmp_path):
+    indir = tmp_path / 'badrootdirident'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-o', str(outfile), str(indir)])
@@ -2660,10 +2897,11 @@
         fp.seek(16*2048 + 156 + 33)
         fp.write(b'\x01')
 
-    do_a_test(tmpdir, outfile, check_nofiles)
+    do_a_test(tmp_path, outfile, check_nofiles)
 
-def test_parse_bad_file_structure_version(tmpdir):
-    indir = tmpdir.mkdir('badfilestructureversion')
+def test_parse_bad_file_structure_version(tmp_path):
+    indir = tmp_path / 'badfilestructureversion'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-o', str(outfile), str(indir)])
@@ -2672,18 +2910,19 @@
         fp.seek(16*2048 + 881)
         fp.write(b'\x02')
 
-    do_a_test(tmpdir, outfile, check_nofiles)
+    do_a_test(tmp_path, outfile, check_nofiles)
 
-def test_parse_get_file_from_iso_not_initialized(tmpdir):
+def test_parse_get_file_from_iso_not_initialized(tmp_path):
     iso = pycdlib.PyCdlib()
 
     with pytest.raises(pycdlib.pycdlibexception.PyCdlibInvalidInput) as excinfo:
         iso.get_file_from_iso('junk')
     assert(str(excinfo.value) == 'This object is not initialized; call either open() or new() to create an ISO')
 
-def test_parse_get_file_from_iso(tmpdir):
+def test_parse_get_file_from_iso(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onefile')
+    indir = tmp_path / 'onefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2701,8 +2940,9 @@
     with open(foofile, 'r') as infp:
         assert(infp.read() == 'foo\n')
 
-def test_parse_joliet_encoded_system_identifier(tmpdir):
-    indir = tmpdir.mkdir('jolietsysident')
+def test_parse_joliet_encoded_system_identifier(tmp_path):
+    indir = tmp_path / 'jolietsysident'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'user-data'), 'wb') as outfp:
         outfp.write(b'''\
@@ -2721,10 +2961,11 @@
                      '-J', '-rational-rock', '-sysid', 'LINUX', '-volid', 'cidata',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_ident_encoding)
+    do_a_test(tmp_path, outfile, check_joliet_ident_encoding)
 
-def test_parse_joliet_hidden_iso_file(tmpdir):
-    indir = tmpdir.mkdir('joliethiddeniso')
+def test_parse_joliet_hidden_iso_file(tmp_path):
+    indir = tmp_path / 'joliethiddeniso'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2733,55 +2974,66 @@
                      '-J', '-hide', 'foo',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_hidden_iso_file)
+    do_a_test(tmp_path, outfile, check_joliet_hidden_iso_file)
 
-def test_parse_udf_nofiles(tmpdir):
-    indir = tmpdir.mkdir('udfnofiles')
+def test_parse_udf_nofiles(tmp_path):
+    indir = tmp_path / 'udfnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_nofiles)
+    do_a_test(tmp_path, outfile, check_udf_nofiles)
 
-def test_parse_udf_onedir(tmpdir):
-    indir = tmpdir.mkdir('udfonedir')
+def test_parse_udf_onedir(tmp_path):
+    indir = tmp_path / 'udfonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_onedir)
+    do_a_test(tmp_path, outfile, check_udf_onedir)
 
-def test_parse_udf_twodirs(tmpdir):
-    indir = tmpdir.mkdir('udftwodirs')
-    outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
-    indir.mkdir('dir2')
+def test_parse_udf_twodirs(tmp_path):
+    indir = tmp_path / 'udftwodirs'
+    indir.mkdir()
+    outfile = str(indir)+'.iso'
+    newdir = indir / 'dir1'
+    newdir.mkdir()
+    newdir = indir / 'dir2'
+    newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_twodirs)
+    do_a_test(tmp_path, outfile, check_udf_twodirs)
 
-def test_parse_udf_subdir(tmpdir):
-    indir = tmpdir.mkdir('udfsubdir')
+def test_parse_udf_subdir(tmp_path):
+    indir = tmp_path / 'udfsubdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('subdir1')
+    newdir = indir / 'dir1' / 'subdir1'
+    newdir.mkdir(parents=True)
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_subdir)
+    do_a_test(tmp_path, outfile, check_udf_subdir)
 
-def test_parse_udf_subdir_odd(tmpdir):
-    indir = tmpdir.mkdir('udfsubdir')
+def test_parse_udf_subdir_odd(tmp_path):
+    indir = tmp_path / 'udfsubdir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('subdi1')
+    newdir = indir / 'dir1' / 'subdi1'
+    newdir.mkdir(parents=True)
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_subdir_odd)
+    do_a_test(tmp_path, outfile, check_udf_subdir_odd)
 
-def test_parse_udf_onefile(tmpdir):
-    indir = tmpdir.mkdir('udfonefile')
+def test_parse_udf_onefile(tmp_path):
+    indir = tmp_path / 'udfonefile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2789,46 +3041,51 @@
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_onefile)
+    do_a_test(tmp_path, outfile, check_udf_onefile)
 
-def test_parse_udf_onefileonedir(tmpdir):
-    indir = tmpdir.mkdir('udfonefileonedir')
+def test_parse_udf_onefileonedir(tmp_path):
+    indir = tmp_path / 'udfonefileonedir'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1')
+    newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
 
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_onefileonedir)
+    do_a_test(tmp_path, outfile, check_udf_onefileonedir)
 
-def test_parse_udf_dir_spillover(tmpdir):
-    indir = tmpdir.mkdir('udfdirspillover')
+def test_parse_udf_dir_spillover(tmp_path):
+    indir = tmp_path / 'udfdirspillover'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     for i in range(ord('a'), ord('v')):
-        dirname = chr(i) * 64
-        indir.mkdir(dirname)
+        dirname = indir / (chr(i) * 64)
+        dirname.mkdir()
 
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_dir_spillover)
+    do_a_test(tmp_path, outfile, check_udf_dir_spillover)
 
-def test_parse_udf_dir_oneshort(tmpdir):
-    indir = tmpdir.mkdir('udfdironeshort')
+def test_parse_udf_dir_oneshort(tmp_path):
+    indir = tmp_path / 'udfdironeshort'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     for i in range(ord('a'), ord('u')):
-        dirname = chr(i) * 64
-        indir.mkdir(dirname)
+        dirname = indir / (chr(i) * 64)
+        dirname.mkdir()
 
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_dir_oneshort)
+    do_a_test(tmp_path, outfile, check_udf_dir_oneshort)
 
-def test_parse_udf_iso_hidden(tmpdir):
-    indir = tmpdir.mkdir('udfisohidden')
+def test_parse_udf_iso_hidden(tmp_path):
+    indir = tmp_path / 'udfisohidden'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2836,11 +3093,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-hide', 'foo', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_iso_hidden)
+    do_a_test(tmp_path, outfile, check_udf_iso_hidden)
 
 @pytest.mark.slow
-def test_parse_udf_very_large(tmpdir):
-    indir = tmpdir.mkdir('udfverylarge')
+def test_parse_udf_very_large(tmp_path):
+    indir = tmp_path / 'udfverylarge'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     largefile = os.path.join(str(indir), 'foo')
     with open(largefile, 'wb') as outfp:
@@ -2849,47 +3107,59 @@
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_very_large)
+    do_a_test(tmp_path, outfile, check_udf_very_large)
 
-def test_parse_joliet_udf_nofiles(tmpdir):
-    indir = tmpdir.mkdir('jolietudfnofiles')
+def test_parse_joliet_udf_nofiles(tmp_path):
+    indir = tmp_path / 'jolietudfnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-J', '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_joliet_udf_nofiles)
+    do_a_test(tmp_path, outfile, check_joliet_udf_nofiles)
 
-def test_parse_udf_dir_exactly2048(tmpdir):
-    indir = tmpdir.mkdir('udfdirspillover')
-    outfile = str(indir)+'.iso'
-    indir.mkdir('a' * 248)
-    indir.mkdir('b' * 248)
-    indir.mkdir('c' * 248)
-    indir.mkdir('d' * 248)
-    indir.mkdir('e' * 248)
-    indir.mkdir('f' * 248)
-    indir.mkdir('g' * 240)
+def test_parse_udf_dir_exactly2048(tmp_path):
+    indir = tmp_path / 'udfdirspillover'
+    indir.mkdir()
+    outfile = str(indir)+'.iso'
+    newdir = indir / ('a' * 248)
+    newdir.mkdir()
+    newdir = indir / ('b' * 248)
+    newdir.mkdir()
+    newdir = indir / ('c' * 248)
+    newdir.mkdir()
+    newdir = indir / ('d' * 248)
+    newdir.mkdir()
+    newdir = indir / ('e' * 248)
+    newdir.mkdir()
+    newdir = indir / ('f' * 248)
+    newdir.mkdir()
+    newdir = indir / ('g' * 240)
+    newdir.mkdir()
 
     subprocess.call(['genisoimage', '-v', '-v', '-no-pad', '-iso-level', '1',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_dir_exactly2048)
+    do_a_test(tmp_path, outfile, check_udf_dir_exactly2048)
 
-def test_parse_udf_overflow_dir_extent(tmpdir):
+def test_parse_udf_overflow_dir_extent(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('udfoverflow')
+    indir = tmp_path / 'udfoverflow'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     numdirs = 46
     for i in range(1, 1+numdirs):
-        indir.mkdir('dir%d' % i)
+        newdir = indir / ('dir%d' % i)
+        newdir.mkdir()
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_overflow_dir_extent)
+    do_a_test(tmp_path, outfile, check_udf_overflow_dir_extent)
 
-def test_parse_multi_hard_link(tmpdir):
-    indir = tmpdir.mkdir('jolietudfnofiles')
+def test_parse_multi_hard_link(tmp_path):
+    indir = tmp_path / 'jolietudfnofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
 
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
@@ -2903,22 +3173,24 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-cache-inodes', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_multi_hard_link)
+    do_a_test(tmp_path, outfile, check_multi_hard_link)
 
-def test_parse_udf_joliet_onefile(tmpdir):
+def test_parse_udf_joliet_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('jolietfile')
+    indir = tmp_path / 'jolietfile'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-J', '-udf', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_udf_joliet_onefile)
+    do_a_test(tmp_path, outfile, check_udf_joliet_onefile)
 
-def test_parse_zero_byte_hard_link(tmpdir):
+def test_parse_zero_byte_hard_link(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('boottable')
+    indir = tmp_path / 'boottable'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         pass
@@ -2926,10 +3198,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_zero_byte_hard_link)
+    do_a_test(tmp_path, outfile, check_zero_byte_hard_link)
 
-def test_parse_unicode_name(tmpdir):
-    indir = tmpdir.mkdir('unicode')
+def test_parse_unicode_name(tmp_path):
+    indir = tmp_path / 'unicode'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'föo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2937,10 +3210,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name)
+    do_a_test(tmp_path, outfile, check_unicode_name)
 
-def test_parse_unicode_name_isolevel4(tmpdir):
-    indir = tmpdir.mkdir('unicodeisolevel4')
+def test_parse_unicode_name_isolevel4(tmp_path):
+    indir = tmp_path / 'unicodeisolevel4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'föo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2948,10 +3222,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_isolevel4)
+    do_a_test(tmp_path, outfile, check_unicode_name_isolevel4)
 
-def test_parse_unicode_name_joliet(tmpdir):
-    indir = tmpdir.mkdir('unicodejoliet')
+def test_parse_unicode_name_joliet(tmp_path):
+    indir = tmp_path / 'unicodejoliet'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'föo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2959,10 +3234,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-J',
                      '-no-pad', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_joliet)
+    do_a_test(tmp_path, outfile, check_unicode_name_joliet)
 
-def test_parse_unicode_name_udf(tmpdir):
-    indir = tmpdir.mkdir('unicodeudf')
+def test_parse_unicode_name_udf(tmp_path):
+    indir = tmp_path / 'unicodeudf'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'föo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2970,10 +3246,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-udf',
                      '-no-pad', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_udf)
+    do_a_test(tmp_path, outfile, check_unicode_name_udf)
 
-def test_parse_unicode_name_two_byte(tmpdir):
-    indir = tmpdir.mkdir('unicode')
+def test_parse_unicode_name_two_byte(tmp_path):
+    indir = tmp_path / 'unicode'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'fᴔo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2981,10 +3258,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_two_byte)
+    do_a_test(tmp_path, outfile, check_unicode_name_two_byte)
 
-def test_parse_unicode_name_two_byte(tmpdir):
-    indir = tmpdir.mkdir('unicode')
+def test_parse_unicode_name_two_byte(tmp_path):
+    indir = tmp_path / 'unicode'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'fᴔo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -2992,10 +3270,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_two_byte)
+    do_a_test(tmp_path, outfile, check_unicode_name_two_byte)
 
-def test_parse_unicode_name_two_byte_isolevel4(tmpdir):
-    indir = tmpdir.mkdir('unicodeisolevel4')
+def test_parse_unicode_name_two_byte_isolevel4(tmp_path):
+    indir = tmp_path / 'unicodeisolevel4'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'fᴔo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -3003,10 +3282,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_two_byte_isolevel4)
+    do_a_test(tmp_path, outfile, check_unicode_name_two_byte_isolevel4)
 
-def test_parse_unicode_name_two_byte_joliet(tmpdir):
-    indir = tmpdir.mkdir('unicodetwobytejoliet')
+def test_parse_unicode_name_two_byte_joliet(tmp_path):
+    indir = tmp_path / 'unicodetwobytejoliet'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'fᴔo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -3014,10 +3294,11 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-J',
                      '-no-pad', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_two_byte_joliet)
+    do_a_test(tmp_path, outfile, check_unicode_name_two_byte_joliet)
 
-def test_parse_unicode_name_two_byte_udf(tmpdir):
-    indir = tmpdir.mkdir('unicodeudftwobyte')
+def test_parse_unicode_name_two_byte_udf(tmp_path):
+    indir = tmp_path / 'unicodeudftwobyte'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'fᴔo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -3025,11 +3306,12 @@
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '1', '-udf',
                      '-no-pad', '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_unicode_name_two_byte_udf)
+    do_a_test(tmp_path, outfile, check_unicode_name_two_byte_udf)
 
-def test_parse_eltorito_get_bootcat(tmpdir):
+def test_parse_eltorito_get_bootcat(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritogetbootcat')
+    indir = tmp_path / 'eltoritogetbootcat'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -3037,11 +3319,12 @@
                      '-c', 'boot.cat', '-b', 'boot', '-no-emul-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_get_bootcat)
+    do_a_test(tmp_path, outfile, check_eltorito_get_bootcat)
 
-def test_parse_eltorito_uefi(tmpdir):
+def test_parse_eltorito_uefi(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('eltoritonofiles')
+    indir = tmp_path / 'eltoritonofiles'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
     with open(os.path.join(str(indir), 'boot'), 'wb') as outfp:
         outfp.write(b'boot\n')
@@ -3049,15 +3332,17 @@
                      '-c', 'boot.cat', '-e', 'boot', '-no-emul-boot',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_eltorito_uefi)
+    do_a_test(tmp_path, outfile, check_eltorito_uefi)
 
-def test_parse_isolevel4_deep_directory(tmpdir):
-    indir = tmpdir.mkdir('isolevel4deep')
+def test_parse_isolevel4_deep_directory(tmp_path):
+    indir = tmp_path / 'isolevel4deep'
+    indir.mkdir()
     outfile = str(indir)+'.iso'
-    indir.mkdir('dir1').mkdir('dir2').mkdir('dir3').mkdir('dir4').mkdir('dir5').mkdir('dir6').mkdir('dir7')
+    newdir = indir / 'dir1' / 'dir2' / 'dir3' / 'dir4' / 'dir5' / 'dir6' / 'dir7'
+    newdir.mkdir(parents=True)
     with open(os.path.join(str(indir), 'dir1', 'dir2', 'dir3', 'dir4', 'dir5', 'dir6', 'dir7', 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
     subprocess.call(['genisoimage', '-v', '-v', '-iso-level', '4', '-no-pad',
                      '-o', str(outfile), str(indir)])
 
-    do_a_test(tmpdir, outfile, check_isolevel4_deep_directory)
+    do_a_test(tmp_path, outfile, check_isolevel4_deep_directory)
--- a/tests/tools/test_pycdlib_genisoimage.py
+++ b/tests/tools/test_pycdlib_genisoimage.py
@@ -50,9 +50,10 @@
 @pytest.mark.skipif(find_executable('isosize') is None or
                     find_executable('isovfy') is None,
                     reason='isosize not installed')
-def test_pycdlib_genisoimage_nofiles(tmpdir):
+def test_pycdlib_genisoimage_nofiles(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('nofiles')
+    indir = tmp_path / 'nofiles'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
 
     def _do_test(binary):
@@ -71,11 +72,13 @@
                     find_executable('isovfy') is None or
                     find_executable('iso-read') is None,
                     reason='isosize not installed')
-def test_pycdlib_genisoimage_onedir(tmpdir):
+def test_pycdlib_genisoimage_onedir(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onedir')
+    indir = tmp_path / 'onedir'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
-    dir1 = indir.mkdir('dir1')
+    dir1 = newdir = indir / 'dir1'
+    newdir.mkdir()
     with open(os.path.join(str(dir1), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
 
@@ -86,7 +89,7 @@
         out, err = run_process(['isosize', str(outfile)])
         genisoimage_size = int(out.strip())
         assert(genisoimage_size == 53248)
-        foocheck = os.path.join(str(tmpdir), 'foocheck')
+        foocheck = os.path.join(str(tmp_path), 'foocheck')
         out, err = run_process(['iso-read', '-i', str(outfile), '-e', 'dir1/foo', '-o', foocheck])
         with open(foocheck, 'rb') as infp:
             assert(infp.read() == b'foo\n')
@@ -99,9 +102,10 @@
                     find_executable('isovfy') is None or
                     find_executable('iso-read') is None,
                     reason='isosize not installed')
-def test_pycdlib_genisoimage_onefile(tmpdir):
+def test_pycdlib_genisoimage_onefile(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onedir')
+    indir = tmp_path / 'onedir'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
     with open(os.path.join(str(indir), 'foo'), 'wb') as outfp:
         outfp.write(b'foo\n')
@@ -113,7 +117,7 @@
         out, err = run_process(['isosize', str(outfile)])
         genisoimage_size = int(out.strip())
         assert(genisoimage_size == 51200)
-        foocheck = os.path.join(str(tmpdir), 'foocheck')
+        foocheck = os.path.join(str(tmp_path), 'foocheck')
         out, err = run_process(['iso-read', '-i', str(outfile), '-e', 'foo', '-o', foocheck])
         with open(foocheck, 'rb') as infp:
             assert(infp.read() == b'foo\n')
@@ -126,9 +130,10 @@
                     find_executable('isovfy') is None or
                     find_executable('iso-read') is None,
                     reason='isosize not installed')
-def test_pycdlib_genisoimage_file_cmdline(tmpdir):
+def test_pycdlib_genisoimage_file_cmdline(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onedir')
+    indir = tmp_path / 'onedir'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
     foofile = os.path.join(str(indir), 'foo')
     with open(foofile, 'wb') as outfp:
@@ -141,7 +146,7 @@
         out, err = run_process(['isosize', str(outfile)])
         genisoimage_size = int(out.strip())
         assert(genisoimage_size == 51200)
-        foocheck = os.path.join(str(tmpdir), 'foocheck')
+        foocheck = os.path.join(str(tmp_path), 'foocheck')
         out, err = run_process(['iso-read', '-i', str(outfile), '-e', 'foo', '-o', foocheck])
         with open(foocheck, 'rb') as infp:
             assert(infp.read() == b'foo\n')
@@ -154,9 +159,10 @@
                     find_executable('isovfy') is None or
                     find_executable('iso-read') is None,
                     reason='isosize not installed')
-def test_pycdlib_genisoimage_boot_file_cmdline(tmpdir):
+def test_pycdlib_genisoimage_boot_file_cmdline(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onedir')
+    indir = tmp_path / 'onedir'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
     bootfile = os.path.join(str(indir), 'boot')
     with open(bootfile, 'wb') as outfp:
@@ -170,7 +176,7 @@
         out, err = run_process(['isosize', str(outfile)])
         genisoimage_size = int(out.strip())
         assert(genisoimage_size == 55296)
-        bootcheck = os.path.join(str(tmpdir), 'bootcheck')
+        bootcheck = os.path.join(str(tmp_path), 'bootcheck')
         out, err = run_process(['iso-read', '-i', str(outfile), '-e', 'boot', '-o', bootcheck])
         with open(bootcheck, 'rb') as infp:
             assert(infp.read() == b'boot\n')
@@ -179,9 +185,10 @@
     _do_test(pycdlib_exe)
 
 
-def test_pycdlib_genisoimage_bootfile_bad(tmpdir):
+def test_pycdlib_genisoimage_bootfile_bad(tmp_path):
     # First set things up, and generate the ISO with genisoimage.
-    indir = tmpdir.mkdir('onedir')
+    indir = tmp_path / 'onedir'
+    indir.mkdir()
     outfile = str(indir) + '.iso'
 
     def _do_test(binary):
--- a/tests/unit/test_utils.py
+++ b/tests/unit/test_utils.py
@@ -197,12 +197,12 @@
 def test_mangle_file_for_iso9660_isolevel3_with_empty_ext():
     assert(pycdlib.utils.mangle_file_for_iso9660('foo.', 3) == ('FOO_', ';1'))
 
-def test_file_object_supports_binary_real_file(tmpdir):
-    testout = tmpdir.join('foo')
+def test_file_object_supports_binary_real_file(tmp_path):
+    testout = tmp_path / 'foo'
     with open(str(testout), 'wb') as outfp:
         assert(pycdlib.utils.file_object_supports_binary(outfp))
 
-def test_file_object_does_not_support_binary_real_file(tmpdir):
-    testout = tmpdir.join('foo')
+def test_file_object_does_not_support_binary_real_file(tmp_path):
+    testout = tmp_path / 'foo'
     with open(str(testout), 'w') as outfp:
         assert(not pycdlib.utils.file_object_supports_binary(outfp))
