From 5fb9c6a5b35220e27b3acd5861318584588cd0d8 Mon Sep 17 00:00:00 2001 From: LaMont Jones Date: Tue, 8 Nov 2022 00:54:56 +0000 Subject: v2.29.7: Revert back to v2.29.5 This change reverts stable to v2.29.5, to fix clients that received v2.29.6, and keep future updates simpler. Change-Id: I2f5c52c466b7321665c9699ccdbf98f928483fee --- tests/test_git_config.py | 14 ----------- tests/test_git_superproject.py | 2 -- tests/test_manifest_xml.py | 16 ++++++------ tests/test_project.py | 8 ------ tests/test_subcmds_sync.py | 55 ++++++------------------------------------ 5 files changed, 14 insertions(+), 81 deletions(-) (limited to 'tests') diff --git a/tests/test_git_config.py b/tests/test_git_config.py index 0df38430..a4fad9ef 100644 --- a/tests/test_git_config.py +++ b/tests/test_git_config.py @@ -19,7 +19,6 @@ import tempfile import unittest import git_config -import repo_trace def fixture(*paths): @@ -34,16 +33,9 @@ class GitConfigReadOnlyTests(unittest.TestCase): def setUp(self): """Create a GitConfig object using the test.gitconfig fixture. """ - - self.tempdirobj = tempfile.TemporaryDirectory(prefix='repo_tests') - repo_trace._TRACE_FILE = os.path.join(self.tempdirobj.name, 'TRACE_FILE_from_test') - config_fixture = fixture('test.gitconfig') self.config = git_config.GitConfig(config_fixture) - def tearDown(self): - self.tempdirobj.cleanup() - def test_GetString_with_empty_config_values(self): """ Test config entries with no value. @@ -117,15 +109,9 @@ class GitConfigReadWriteTests(unittest.TestCase): """Read/write tests of the GitConfig class.""" def setUp(self): - self.tempdirobj = tempfile.TemporaryDirectory(prefix='repo_tests') - repo_trace._TRACE_FILE = os.path.join(self.tempdirobj.name, 'TRACE_FILE_from_test') - self.tmpfile = tempfile.NamedTemporaryFile() self.config = self.get_config() - def tearDown(self): - self.tempdirobj.cleanup() - def get_config(self): """Get a new GitConfig instance.""" return git_config.GitConfig(self.tmpfile.name) diff --git a/tests/test_git_superproject.py b/tests/test_git_superproject.py index 0bb77185..0ad9b01d 100644 --- a/tests/test_git_superproject.py +++ b/tests/test_git_superproject.py @@ -24,7 +24,6 @@ from unittest import mock import git_superproject import git_trace2_event_log import manifest_xml -import repo_trace from test_manifest_xml import sort_attributes @@ -40,7 +39,6 @@ class SuperprojectTestCase(unittest.TestCase): """Set up superproject every time.""" self.tempdirobj = tempfile.TemporaryDirectory(prefix='repo_tests') self.tempdir = self.tempdirobj.name - repo_trace._TRACE_FILE = os.path.join(self.tempdir, 'TRACE_FILE_from_test') self.repodir = os.path.join(self.tempdir, '.repo') self.manifest_file = os.path.join( self.repodir, manifest_xml.MANIFEST_FILE_NAME) diff --git a/tests/test_manifest_xml.py b/tests/test_manifest_xml.py index f92108e1..e181b642 100644 --- a/tests/test_manifest_xml.py +++ b/tests/test_manifest_xml.py @@ -23,7 +23,6 @@ import xml.dom.minidom import error import manifest_xml -import repo_trace # Invalid paths that we don't want in the filesystem. @@ -94,7 +93,6 @@ class ManifestParseTestCase(unittest.TestCase): def setUp(self): self.tempdirobj = tempfile.TemporaryDirectory(prefix='repo_tests') self.tempdir = self.tempdirobj.name - repo_trace._TRACE_FILE = os.path.join(self.tempdir, 'TRACE_FILE_from_test') self.repodir = os.path.join(self.tempdir, '.repo') self.manifest_dir = os.path.join(self.repodir, 'manifests') self.manifest_file = os.path.join( @@ -264,10 +262,10 @@ class XmlManifestTests(ManifestParseTestCase): '' '') self.assertEqual( - sort_attributes(manifest.ToXml(omit_local=True).toxml()), + manifest.ToXml(omit_local=True).toxml(), '' - '' - '') + '' + '') def test_toxml_with_local(self): """Does include local_manifests projects when omit_local=False.""" @@ -279,11 +277,11 @@ class XmlManifestTests(ManifestParseTestCase): '' '') self.assertEqual( - sort_attributes(manifest.ToXml(omit_local=False).toxml()), + manifest.ToXml(omit_local=False).toxml(), '' - '' - '' - '') + '' + '' + '') def test_repo_hooks(self): """Check repo-hooks settings.""" diff --git a/tests/test_project.py b/tests/test_project.py index 5c600be7..acd44ccc 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -26,7 +26,6 @@ import git_command import git_config import platform_utils import project -import repo_trace @contextlib.contextmanager @@ -65,13 +64,6 @@ class FakeProject(object): class ReviewableBranchTests(unittest.TestCase): """Check ReviewableBranch behavior.""" - def setUp(self): - self.tempdirobj = tempfile.TemporaryDirectory(prefix='repo_tests') - repo_trace._TRACE_FILE = os.path.join(self.tempdirobj.name, 'TRACE_FILE_from_test') - - def tearDown(self): - self.tempdirobj.cleanup() - def test_smoke(self): """A quick run through everything.""" with TempGitTree() as tempdir: diff --git a/tests/test_subcmds_sync.py b/tests/test_subcmds_sync.py index 13f3f873..aad713f2 100644 --- a/tests/test_subcmds_sync.py +++ b/tests/test_subcmds_sync.py @@ -11,9 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. + """Unittests for the subcmds/sync.py module.""" -import unittest from unittest import mock import pytest @@ -21,14 +21,17 @@ import pytest from subcmds import sync -@pytest.mark.parametrize('use_superproject, cli_args, result', [ +@pytest.mark.parametrize( + 'use_superproject, cli_args, result', + [ (True, ['--current-branch'], True), (True, ['--no-current-branch'], True), (True, [], True), (False, ['--current-branch'], True), (False, ['--no-current-branch'], False), (False, [], None), -]) + ] +) def test_get_current_branch_only(use_superproject, cli_args, result): """Test Sync._GetCurrentBranchOnly logic. @@ -38,49 +41,5 @@ def test_get_current_branch_only(use_superproject, cli_args, result): cmd = sync.Sync() opts, _ = cmd.OptionParser.parse_args(cli_args) - with mock.patch('git_superproject.UseSuperproject', - return_value=use_superproject): + with mock.patch('git_superproject.UseSuperproject', return_value=use_superproject): assert cmd._GetCurrentBranchOnly(opts, cmd.manifest) == result - - -class GetPreciousObjectsState(unittest.TestCase): - """Tests for _GetPreciousObjectsState.""" - - def setUp(self): - """Common setup.""" - self.cmd = sync.Sync() - self.project = p = mock.MagicMock(use_git_worktrees=False, - UseAlternates=False) - p.manifest.GetProjectsWithName.return_value = [p] - - self.opt = mock.Mock(spec_set=['this_manifest_only']) - self.opt.this_manifest_only = False - - def test_worktrees(self): - """False for worktrees.""" - self.project.use_git_worktrees = True - self.assertFalse(self.cmd._GetPreciousObjectsState(self.project, self.opt)) - - def test_not_shared(self): - """Singleton project.""" - self.assertFalse(self.cmd._GetPreciousObjectsState(self.project, self.opt)) - - def test_shared(self): - """Shared project.""" - self.project.manifest.GetProjectsWithName.return_value = [ - self.project, self.project - ] - self.assertTrue(self.cmd._GetPreciousObjectsState(self.project, self.opt)) - - def test_shared_with_alternates(self): - """Shared project, with alternates.""" - self.project.manifest.GetProjectsWithName.return_value = [ - self.project, self.project - ] - self.project.UseAlternates = True - self.assertFalse(self.cmd._GetPreciousObjectsState(self.project, self.opt)) - - def test_not_found(self): - """Project not found in manifest.""" - self.project.manifest.GetProjectsWithName.return_value = [] - self.assertFalse(self.cmd._GetPreciousObjectsState(self.project, self.opt)) -- cgit v1.2.3-54-g00ecf