Skip to content

Commit

Permalink
Remove the workaround for bazelbuild/bazel#4001.
Browse files Browse the repository at this point in the history
It has been fixed since bazel 0.10.0.

PiperOrigin-RevId: 189957103
  • Loading branch information
yilei authored and Copybara-Service committed Mar 21, 2018
1 parent 3cb55c6 commit faf9cfc
Showing 1 changed file with 6 additions and 20 deletions.
26 changes: 6 additions & 20 deletions absl/testing/tests/absltest_test_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,43 +47,29 @@ def test_flags(self):
self.assertTrue(os.access(FLAGS.test_tmpdir, os.W_OK))
elif FLAGS.test_id == 2:
self.assertEqual(FLAGS.test_random_seed, 321)
self._assert_directories_equal(
self.assertEqual(
FLAGS.test_srcdir,
os.environ['ABSLTEST_TEST_HELPER_EXPECTED_TEST_SRCDIR'])
self._assert_directories_equal(
self.assertEqual(
FLAGS.test_tmpdir,
os.environ['ABSLTEST_TEST_HELPER_EXPECTED_TEST_TMPDIR'])
elif FLAGS.test_id == 3:
self.assertEqual(FLAGS.test_random_seed, 123)
self._assert_directories_equal(
self.assertEqual(
FLAGS.test_srcdir,
os.environ['ABSLTEST_TEST_HELPER_EXPECTED_TEST_SRCDIR'])
self._assert_directories_equal(
self.assertEqual(
FLAGS.test_tmpdir,
os.environ['ABSLTEST_TEST_HELPER_EXPECTED_TEST_TMPDIR'])
elif FLAGS.test_id == 4:
self.assertEqual(FLAGS.test_random_seed, 221)
self._assert_directories_equal(
self.assertEqual(
FLAGS.test_srcdir,
os.environ['ABSLTEST_TEST_HELPER_EXPECTED_TEST_SRCDIR'])
self._assert_directories_equal(
self.assertEqual(
FLAGS.test_tmpdir,
os.environ['ABSLTEST_TEST_HELPER_EXPECTED_TEST_TMPDIR'])

def _assert_directories_equal(self, expected, actual):
if os.name == 'nt':
# Bazel on Windows has a bug where backslashes passed to subprocess are
# unnecessarily unescaped. This is the workaround before a new Bazel
# release that includes the fix is available.
# See https://github.com/bazelbuild/bazel/issues/4001.
if expected == actual:
return
if expected == actual.replace('\\', '\\\\'):
return
raise AssertionError('{} != {}', expected, actual)
else:
self.assertEqual(expected, actual)

@unittest.expectedFailure
def test_expected_failure(self):
if FLAGS.test_id == 5:
Expand Down

0 comments on commit faf9cfc

Please sign in to comment.