def test_worldfile_atom(self): self.formatter.world_list = [atom('app-arch/bzip2')] self.formatter.format(FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6'))) self.assertOut('[', Color('fg', 'green'), Bold(), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), Bold(), 'app-arch/bzip2-1.0.3-r6', Reset())
def test_repo_id(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo1))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset())
def test_end(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo1))) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo2))) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo3))) self.fakeout.resetstream() self.formatter.end() self.assertOut('\nTotal: 3 packages (3 new)\n\n', ' ', Color('fg', 'cyan'), '[1]', Reset(), ' gentoo (/usr/portage)\n', ' ', Color('fg', 'cyan'), '[2]', Reset(), ' fakerepo (/var/gentoo/repos/fakerepo)\n', ' ', Color('fg', 'cyan'), '[3]', Reset(), ' /usr/local/portage\n', suffix=[''])
def test_new_nouse(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'blue'), Bold(), '-static', Reset(), '"')
def test_upgrade(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.4'), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'cyan'), Bold(), 'U', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.4', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.3-r6]', Reset())
def test_reinstall(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo1), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', repo=self.repo1))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset())
def test_nouse(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'yellow'), Bold(), '-static', Reset(), '%"')
def test_iuse_stripped(self): self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', eapi='1', iuse=['+static', '-junk'], use=['static']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'yellow'), Bold(), 'static', Reset(), "%* ", Color('fg', 'yellow'), Bold(), '-junk', Reset(), '%"')
def test_disabled_use(self): self.formatter.disabled_use = collapsed_restrict_to_data( ([(atom('=app-arch/bzip2-1.0.3-r6'), ('static'))])) self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static', 'bootstrap']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'blue'), Bold(), '-bootstrap', Reset(), ' ', '(', Color('fg', 'blue'), Bold(), '-static', Reset(), ')"')
def test_disabled_use(self): self.formatter.pkg_get_use = lambda pkg: (set(), set(), set(['static']) ) self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static', 'bootstrap']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'blue'), Bold(), '-bootstrap', Reset(), ' ', '(', Color('fg', 'blue'), Bold(), '-static', Reset(), ')"')
def test_forced_use_verbose(self): self.formatter.pkg_get_use = lambda pkg: (set(['static']), set(), set( )) # rebuilt pkg: unchanged static use flag forced on self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static'], use=['static']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', iuse=['static'], use=['static']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="(', Color('fg', 'red'), Bold(), 'static', Reset(), ')"')
def test_forced_use_verbose(self): self.formatter.forced_use = collapsed_restrict_to_data( ([(atom('=app-arch/bzip2-1.0.3-r6'), ('static'))])) # rebuilt pkg: unchanged static use flag forced on self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static'], use=['static']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', iuse=['static'], use=['static']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="(', Color('fg', 'red'), Bold(), 'static', Reset(), ')"')
def test_misc(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', slot='1'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), Color('fg', 'green'), Bold(), 'S', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.1-r1]', Reset()) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', restrict='fetch'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ', Color('fg', 'red'), Bold(), 'F', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset())
def test_use_expand(self): self.formatter = self.newFormatter(use_expand=set(["foo", "bar"])) self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['foo_static', 'foo_bootstrap', 'bar_baz'], use=['foo_static', 'bar_baz']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' BAR="', Color('fg', 'yellow'), Bold(), 'baz', Reset(), '%*"', ' FOO="', Color('fg', 'yellow'), Bold(), 'static', Reset(), '%* ', Color('fg', 'yellow'), Bold(), '-bootstrap', Reset(), '%"')
def test_removed_use(self): self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static'], use=['static']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', iuse=['static', 'bootstrap', 'foo'], use=['static', 'foo']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'red'), Bold(), 'static', Reset(), ' ', '(', Color('fg', 'yellow'), Bold(), '-bootstrap', Reset(), '%) ', '(', Color('fg', 'yellow'), Bold(), '-foo', Reset(), '%*)"')
def test_new(self): self.formatter.format(FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.4'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.4', Reset())
def test_changed_use(self): self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', iuse=['static', 'bootstrap'], use=['static']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', iuse=['static'], use=['static']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'red'), Bold(), 'static', Reset(), ' ', Color('fg', 'yellow'), Bold(), '-bootstrap', Reset(), '%"') self.formatter.format( FakeOp( FakeEbuildSrc( 'app-arch/bzip2-1.0.3-r6', iuse=['static', 'bootstrap', 'perl', 'foobar', 'rice'], use=['static', 'rice']), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', iuse=['bootstrap', 'foobar', 'rice', 'kazaam'], use=['foobar']))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'yellow'), Bold(), 'R', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset(), ' USE="', Color('fg', 'green'), Bold(), 'rice', Reset(), '* ', Color('fg', 'yellow'), Bold(), 'static', Reset(), '%* ', Color('fg', 'blue'), Bold(), '-bootstrap', Reset(), ' ', Color('fg', 'green'), Bold(), '-foobar', Reset(), '* ', Color('fg', 'yellow'), Bold(), '-perl', Reset(), '% ', '(', Color('fg', 'yellow'), Bold(), '-kazaam', Reset(), '%)"')
def test_misc(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', slot='0'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset()) self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', slot='0', subslot='0'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6', Reset()) self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', slot='0', subslot='2'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6:0/2', Reset()) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', slot='foo'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), Color('fg', 'green'), Bold(), 'S', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6:foo', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.1-r1:0]', Reset()) self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', slot='1', subslot='0'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), Color('fg', 'green'), Bold(), 'S', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6:1/0', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.1-r1:0]', Reset()) self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', slot='2', subslot='foo'))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), Color('fg', 'green'), Bold(), 'S', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6:2/foo', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.1-r1:0]', Reset())
def test_repo_id(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo1))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6::gentoo', Reset()) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo2))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6::fakerepo', Reset()) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.4', repo=self.repo1), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', repo=self.repo1))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'cyan'), Bold(), 'U', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.4::gentoo', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.3-r6::gentoo]', Reset()) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.4', repo=self.repo2), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', repo=self.repo1))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'cyan'), Bold(), 'U', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.4::fakerepo', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.3-r6::gentoo]', Reset()) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.4', repo=self.repo1), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', repo=self.repo2))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'cyan'), Bold(), 'U', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.4::gentoo', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.3-r6::fakerepo]', Reset()) self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.4', repo=self.repo2), FakeMutatedPkg('app-arch/bzip2-1.0.3-r6', repo=self.repo2))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'cyan'), Bold(), 'U', Reset(), ' ] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.4::fakerepo', Reset(), ' ', Color('fg', 'blue'), Bold(), '[1.0.3-r6::fakerepo]', Reset())
def test_install_symbols(self): # unkeyworded self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo1, keywords=()))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ', Color('fg', 'red'), Bold(), '*', Reset(), '] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6%s' % self.repo_id(self.repo1), Reset()) # unstable arch self.formatter.format( FakeOp( FakeEbuildSrc('app-arch/bzip2-1.0.3-r6', repo=self.repo1, keywords=('~amd64', )))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ', Color('fg', 'yellow'), Bold(), '~', Reset(), '] ', Color('fg', 'green'), 'app-arch/bzip2-1.0.3-r6%s' % self.repo_id(self.repo1), Reset()) # masked self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-2.1', repo=self.repo1))) self.assertOut('[', Color('fg', 'green'), 'ebuild', Reset(), ' ', Color('fg', 'green'), Bold(), 'N', Reset(), ' ', Color('fg', 'red'), Bold(), '#', Reset(), '] ', Color('fg', 'green'), 'app-arch/bzip2-2.1%s' % self.repo_id(self.repo1), Reset())
def test_remove(self): self.formatter.format( FakeOp(FakeEbuildSrc('app-arch/bzip2-1.0.4'), desc='remove')) self.assertOut('[', Color('fg', 'red'), 'uninstall', Reset(), ' ] ', Color('fg', 'red'), 'app-arch/bzip2-1.0.4', Reset())