Skip to content

Commit e3c7784

Browse files
authored
Make torchaudio work on Python 2. (#211)
#209
1 parent 96c83a8 commit e3c7784

16 files changed

+20
-8
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ cache:
1212
matrix:
1313
fast_finish: true
1414
include:
15-
- env: PYTHON_VERSION="3.5"
15+
- env: PYTHON_VERSION="3.7"
1616
- env: PYTHON_VERSION="3.6"
1717
- env: PYTHON_VERSION="3.5" RUN_FLAKE8="true" SKIP_TESTS="true"
18+
- env: PYTHON_VERSION="2.7"
1819

1920
addons:
2021
apt:

requirements.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ scipy
1515

1616
# Unit tests with pytest
1717
pytest
18+
19+
# Testing only Py3 compat
20+
backports.tempfile

test/common_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
from __future__ import absolute_import, division, print_function, unicode_literals
12
import os
23
from shutil import copytree
3-
import tempfile
4+
import backports.tempfile as tempfile
45

56

67
TEST_DIR_PATH = os.path.dirname(os.path.realpath(__file__))

test/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import absolute_import, division, print_function, unicode_literals
12
import unittest
23
import common_utils
34
import torch

test/test_dataloader.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import absolute_import, division, print_function, unicode_literals
12
import unittest
23
import common_utils
34
import torch

test/test_kaldi_io.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import absolute_import, division, print_function, unicode_literals
12
import os
23
import torch
34
import torchaudio.kaldi_io as kio

test/test_sox_effects.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import absolute_import, division, print_function, unicode_literals
12
import unittest
23
import common_utils
34
import torch

test/test_transforms.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import print_function
1+
from __future__ import absolute_import, division, print_function, unicode_literals
22
import math
33
import os
44

torchaudio/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from __future__ import division, print_function
1+
from __future__ import absolute_import, division, print_function, unicode_literals
22
import os.path
33

44
import torch

torchaudio/common_utils.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from __future__ import absolute_import, division, print_function, unicode_literals
12
import sys
23

34
PY3 = sys.version_info > (3, 0)

0 commit comments

Comments
 (0)