diff --git a/pysnooper/tracer.py b/pysnooper/tracer.py index 6303083..db349ec 100644 --- a/pysnooper/tracer.py +++ b/pysnooper/tracer.py @@ -139,9 +139,7 @@ class Tracer: if self.overwrite and not self._did_overwrite: self.truncate() self._did_overwrite = True - s = '{self.prefix}{s}\n'.format(**locals()) - if isinstance(s, bytes): # Python 2 compatibility - s = s.decode() + s = u'{self.prefix}{s}\n'.format(**locals()) self._write(s) def __enter__(self): diff --git a/tests/test_pysnooper.py b/tests/test_pysnooper.py index 195926e..81f7102 100644 --- a/tests/test_pysnooper.py +++ b/tests/test_pysnooper.py @@ -275,13 +275,11 @@ def test_unavailable_source(): sys_tools.TempSysPathAdder(str(folder)): module_name = 'iaerojajsijf' python_file_path = folder / ('%s.py' % (module_name,)) - content = ('import pysnooper\n' + content = (u'import pysnooper\n' '\n' '@pysnooper.snoop()\n' 'def f(x):\n' ' return x\n') - if six.PY2: - content = content.decode() with python_file_path.open('w') as python_file: python_file.write(content) module = __import__(module_name)