unittest: remove redundant chdir
We use chromite's TestCase which handles restoring cwd at the
end of tests, so no need to do that ourselves here.
BUG=None
TEST=unittests pass
Change-Id: I592df5a34cbbced1e398f29e2b43ad8c3a6524fa
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/repohooks/+/2551819
Reviewed-by: Chirantan Ekbote <chirantan@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
diff --git a/pre-upload_unittest.py b/pre-upload_unittest.py
index 93a8f6f..e742711 100755
--- a/pre-upload_unittest.py
+++ b/pre-upload_unittest.py
@@ -352,14 +352,10 @@
"""Tests for _check_project_prefix."""
def setUp(self):
- self.orig_cwd = os.getcwd()
os.chdir(self.tempdir)
self.file_mock = self.PatchObject(pre_upload, '_get_affected_files')
self.desc_mock = self.PatchObject(pre_upload, '_get_commit_desc')
- def tearDown(self):
- os.chdir(self.orig_cwd)
-
def _WriteAliasFile(self, filename, project):
"""Writes a project name to a file, creating directories if needed."""
os.makedirs(os.path.dirname(filename))
@@ -1507,7 +1503,6 @@
"""Various tests for utility functions."""
def setUp(self):
- self.orig_cwd = os.getcwd()
os.chdir(self.tempdir)
self.PatchObject(git, 'RawDiff', return_value=[
@@ -1520,9 +1515,6 @@
DiffEntry(src_file='scripts/sync_sonic.py', status='D'),
])
- def tearDown(self):
- os.chdir(self.orig_cwd)
-
def _WritePresubmitIgnoreFile(self, subdir, data):
"""Writes to a .presubmitignore file in the passed-in subdirectory."""
directory = os.path.join(self.tempdir, subdir)