commit:     0655b4a26e378cf409c9a033514f41c307d01371
Author:     Alexandru Elisei <alexandru.elisei <AT> gmail <DOT> com>
AuthorDate: Sun Jan 29 18:07:34 2017 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Jan 31 21:02:50 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0655b4a2

test_sync_local: add test for auto-sync set to 'no'

 pym/portage/tests/sync/test_sync_local.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/pym/portage/tests/sync/test_sync_local.py 
b/pym/portage/tests/sync/test_sync_local.py
index bec2e6a..1d38562 100644
--- a/pym/portage/tests/sync/test_sync_local.py
+++ b/pym/portage/tests/sync/test_sync_local.py
@@ -42,7 +42,7 @@ class SyncLocalTestCase(TestCase):
                        location = %(EPREFIX)s/var/repositories/test_repo
                        sync-type = %(sync-type)s
                        sync-uri = 
file:/%(EPREFIX)s/var/repositories/test_repo_sync
-                       auto-sync = yes
+                       auto-sync = %(auto-sync)s
                        %(repo_extra_keys)s
                """)
 
@@ -87,9 +87,11 @@ class SyncLocalTestCase(TestCase):
                committer_name = "Gentoo Dev"
                committer_email = "gentoo-...@gentoo.org"
 
-               def repos_set_conf(sync_type, dflt_keys=None, xtra_keys=None):
+               def repos_set_conf(sync_type, dflt_keys=None, xtra_keys=None,
+                       auto_sync="yes"):
                        env["PORTAGE_REPOSITORIES"] = repos_conf % {\
                                "EPREFIX": eprefix, "sync-type": sync_type,
+                               "auto-sync": auto_sync,
                                "default_keys": "" if dflt_keys is None else 
dflt_keys,
                                "repo_extra_keys": "" if xtra_keys is None else 
xtra_keys}
 
@@ -100,6 +102,12 @@ class SyncLocalTestCase(TestCase):
                        os.unlink(os.path.join(metadata_dir, 'timestamp.chk'))
 
                sync_cmds = (
+                       (homedir, lambda: repos_set_conf("rsync", 
auto_sync="no")),
+                       (homedir, cmds["emerge"] + ("--sync",)),
+                       (homedir, lambda: self.assertFalse(os.path.exists(
+                               os.path.join(repo.location, "dev-libs", "A")
+                               ), "dev-libs/A found, expected missing")),
+                       (homedir, lambda: repos_set_conf("rsync", 
auto_sync="yes")),
                        (homedir, cmds["emerge"] + ("--sync",)),
                        (homedir, lambda: self.assertTrue(os.path.exists(
                                os.path.join(repo.location, "dev-libs", "A")

Reply via email to