|
1 | 1 | #!/usr/bin/env python
|
2 | 2 | # -*- coding: utf-8 -*-
|
3 | 3 |
|
4 |
| -from __future__ import absolute_import, division, print_function, unicode_literals |
| 4 | +from __future__ import absolute_import, print_function |
5 | 5 | import unittest
|
6 | 6 | import json
|
7 | 7 | from tests import fixtures
|
8 | 8 | from skinfer import schema_inferer
|
9 |
| -import subprocess |
| 9 | +from subprocess import check_output |
10 | 10 |
|
11 | 11 |
|
12 | 12 | class TestJsonSchemaInferer(unittest.TestCase):
|
@@ -39,28 +39,6 @@ def test_load_jsonlines_samples(self):
|
39 | 39 | self.assertEquals(3, len(samples))
|
40 | 40 |
|
41 | 41 |
|
42 |
| -def check_output(*popenargs, **kwargs): |
43 |
| - r"""Run command with arguments and return its output as a byte string. |
44 |
| -
|
45 |
| - Backported from Python 2.7 as it's implemented as pure python on stdlib. |
46 |
| -
|
47 |
| - >>> check_output(['/usr/bin/python', '--version']) |
48 |
| - Python 2.6.2 |
49 |
| - """ |
50 |
| - # FROM: https://gist.github.com/edufelipe/1027906 |
51 |
| - process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) |
52 |
| - output, unused_err = process.communicate() |
53 |
| - retcode = process.poll() |
54 |
| - if retcode: |
55 |
| - cmd = kwargs.get("args") |
56 |
| - if cmd is None: |
57 |
| - cmd = popenargs[0] |
58 |
| - error = subprocess.CalledProcessError(retcode, cmd) |
59 |
| - error.output = output |
60 |
| - raise error |
61 |
| - return output |
62 |
| - |
63 |
| - |
64 | 42 | class TestCasePython26Shim(unittest.TestCase):
|
65 | 43 | def assertIsNotNone(self, value):
|
66 | 44 | self.assertFalse(value is None, "%r is not None" % value)
|
|
0 commit comments