diff --git a/html5lib/tests/support.py b/html5lib/tests/support.py
index 9cd5afbe..1bd0ccc1 100644
--- a/html5lib/tests/support.py
+++ b/html5lib/tests/support.py
@@ -8,7 +8,7 @@
import glob
import xml.sax.handler
-base_path = os.path.split(__file__)[0]
+base_path = os.path.dirname(__file__)
test_dir = os.path.join(base_path, 'testdata')
sys.path.insert(0, os.path.abspath(os.path.join(base_path,
diff --git a/html5lib/tests/tokenizertotree.py b/html5lib/tests/tokenizertotree.py
index 8528e876..42463f32 100644
--- a/html5lib/tests/tokenizertotree.py
+++ b/html5lib/tests/tokenizertotree.py
@@ -29,7 +29,7 @@ def run_file(filename, out_path):
except ValueError:
sys.stderr.write("Failed to load %s\n" % filename)
return
- name = os.path.splitext(os.path.split(filename)[1])[0]
+ name = os.path.splitext(os.path.basename(filename))[0]
output_file = open(os.path.join(out_path, "tokenizer_%s.dat" % name), "w")
if 'tests' in tests_data: