Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
hhatto committed Mar 31, 2021
1 parent 745faa8 commit 9274aac
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions test/test_autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -5506,8 +5506,8 @@ def test_exit_code_with_io_error(self):
print(filename)
p = Popen(list(AUTOPEP8_CMD_TUPLE) + ['--in-place', filename],
stdout=PIPE, stderr=PIPE)
result = p.communicate()
self.assertEqual(p.returncode, 1)
p.communicate()
self.assertEqual(p.returncode, autopep8.EXIT_CODE_ERROR)

def test_pep8_passes(self):
line = "'abc' \n"
Expand Down Expand Up @@ -5654,7 +5654,6 @@ def test_parallel_jobs(self):

def test_parallel_jobs_with_diff_option(self):
line = "'abc' \n"
fixed = "'abc'\n"

with temporary_file_context(line) as filename_a:
with temporary_file_context(line) as filename_b:
Expand All @@ -5673,7 +5672,7 @@ def test_parallel_jobs_with_diff_option(self):
-'abc'
+'abc'
""".format(filename=filename))
self.assertEqual(0, p.returncode)
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)
for actual_diff in actual_diffs:
self.assertIn(actual_diff, output)

Expand All @@ -5694,8 +5693,8 @@ def test_parallel_jobs_with_inplace_option_and_io_error(self):
p = Popen(list(AUTOPEP8_CMD_TUPLE) +
[temp_directory, '--recursive', '--in-place'],
stdout=PIPE, stderr=PIPE)
result = p.communicate()[0].decode('utf-8')
self.assertEqual(p.returncode, 1)
p.communicate()[0].decode('utf-8')
self.assertEqual(p.returncode, autopep8.EXIT_CODE_ERROR)
finally:
shutil.rmtree(temp_directory)

Expand Down Expand Up @@ -6048,7 +6047,7 @@ def test_pyproject_toml_with_flake8_config(self):
fp.write(line)
p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename], stdout=PIPE)
self.assertEqual(p.communicate()[0].decode("utf-8"), line)
self.assertEqual(p.returncode, 0)
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)

def test_pyproject_toml_with_verbose_option(self):
"""override to flake8 config"""
Expand All @@ -6065,7 +6064,7 @@ def test_pyproject_toml_with_verbose_option(self):
output = p.communicate()[0].decode("utf-8")
self.assertTrue(line in output)
self.assertTrue(verbose_line in output)
self.assertEqual(p.returncode, 0)
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)

def test_pyproject_toml_with_iterable_value(self):
line = "a = 1\n"
Expand All @@ -6079,7 +6078,7 @@ def test_pyproject_toml_with_iterable_value(self):
p = Popen(list(AUTOPEP8_CMD_TUPLE) + [target_filename, ], stdout=PIPE)
output = p.communicate()[0].decode("utf-8")
self.assertTrue(line in output)
self.assertEqual(p.returncode, 0)
self.assertEqual(p.returncode, autopep8.EXIT_CODE_OK)


class ExperimentalSystemTests(unittest.TestCase):
Expand Down

0 comments on commit 9274aac

Please sign in to comment.