Gentoo Archives: gentoo-portage-dev

From: Alexandru Elisei <alexandru.elisei@×××××.com>
To: gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] [PATCH] test_sync_local: add test for auto-sync set to 'no'
Date: Sun, 29 Jan 2017 19:23:01
Message-Id: CAB-4s4kNqVsO1HjPFMVbx3q5=JxR0aDptNkFfPxsAAxpoiu1qw@mail.gmail.com
1 ---
2 pym/portage/tests/sync/test_sync_local.py | 12 ++++++++++--
3 1 file changed, 10 insertions(+), 2 deletions(-)
4
5 diff --git a/pym/portage/tests/sync/test_sync_local.py
6 b/pym/portage/tests/sync/test_sync_local.py
7 index bec2e6a..1d38562 100644
8 --- a/pym/portage/tests/sync/test_sync_local.py
9 +++ b/pym/portage/tests/sync/test_sync_local.py
10 @@ -42,7 +42,7 @@ class SyncLocalTestCase(TestCase):
11 location = %(EPREFIX)s/var/repositories/test_repo
12 sync-type = %(sync-type)s
13 sync-uri = file:/%(EPREFIX)s/var/repositories/test_repo_sync
14 - auto-sync = yes
15 + auto-sync = %(auto-sync)s
16 %(repo_extra_keys)s
17 """)
18
19 @@ -87,9 +87,11 @@ class SyncLocalTestCase(TestCase):
20 committer_name = "Gentoo Dev"
21 committer_email = "gentoo-dev@g.o"
22
23 - def repos_set_conf(sync_type, dflt_keys=None, xtra_keys=None):
24 + def repos_set_conf(sync_type, dflt_keys=None, xtra_keys=None,
25 + auto_sync="yes"):
26 env["PORTAGE_REPOSITORIES"] = repos_conf % {\
27 "EPREFIX": eprefix, "sync-type": sync_type,
28 + "auto-sync": auto_sync,
29 "default_keys": "" if dflt_keys is None else dflt_keys,
30 "repo_extra_keys": "" if xtra_keys is None else xtra_keys}
31
32 @@ -100,6 +102,12 @@ class SyncLocalTestCase(TestCase):
33 os.unlink(os.path.join(metadata_dir, 'timestamp.chk'))
34
35 sync_cmds = (
36 + (homedir, lambda: repos_set_conf("rsync", auto_sync="no")),
37 + (homedir, cmds["emerge"] + ("--sync",)),
38 + (homedir, lambda: self.assertFalse(os.path.exists(
39 + os.path.join(repo.location, "dev-libs", "A")
40 + ), "dev-libs/A found, expected missing")),
41 + (homedir, lambda: repos_set_conf("rsync", auto_sync="yes")),
42 (homedir, cmds["emerge"] + ("--sync",)),
43 (homedir, lambda: self.assertTrue(os.path.exists(
44 os.path.join(repo.location, "dev-libs", "A")
45 --
46 2.10.2