def test_warn_if_not_including_local_deb(self): package_name = "foo" local_name = "bar" maker = PackageMaker() self.useFixture(ContextManagerFixture(maker)) remote_package = DummyFetchedPackage(package_name, "1.1") local_path = maker.make_package(local_name, "1.0", {}) sources_dict = self.sourcesDictForPackages([remote_package]) metadata, config = self.makeMetaDataAndConfigFixture( [package_name], sources_dict, extra_config={'assume-installed': local_name}) builder = HardwarePackBuilder(config.filename, metadata.version, [local_path]) handler = AppendingHandler() builder_logger.addHandler(handler) self.addCleanup(builder_logger.removeHandler, handler) builder.build() self.assertThat( "hwpack_%s_%s_%s.tar.gz" % (metadata.name, metadata.version, metadata.architecture), IsHardwarePack(metadata, [remote_package], sources_dict, package_spec=package_name)) self.assertThat( handler.messages, EachOf([MatchesStructure(levelname=Equals('WARNING'))])) self.assertThat(handler.messages[0].getMessage(), Equals("Local package 'bar' not included"))
def test_add_dependency_package_adds_package_to_Packages(self): hwpack = HardwarePack(self.metadata) hwpack.add_dependency_package(["foo", "bar (= 1.0)"]) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile( "pkgs/Packages", content_matcher=MatchesAsPackagesFile( MatchesStructure( name=Equals('hwpack-' + self.metadata.name), architecture=Equals(self.metadata.architecture), depends=MatchesPackageRelationshipList( [Equals("foo"), Equals("bar (= 1.0)")]), version=Equals(self.metadata.version)))))
def test_add_dependency_package_adds_package(self): hwpack = HardwarePack(self.metadata) hwpack.add_dependency_package([]) tf = self.get_tarfile(hwpack) self.assertThat( tf, HardwarePackHasFile( "pkgs/%s_%s_%s.deb" % ('hwpack-' + self.metadata.name, self.metadata.version, self.metadata.architecture), content_matcher=MatchesAsPackageContent( MatchesStructure( name=Equals('hwpack-' + self.metadata.name), architecture=Equals(self.metadata.architecture), depends=Equals(None), version=Equals(self.metadata.version)))))
def test_fromExample(self): self.assertThat( self.SimpleClass(1), MatchesStructure.fromExample(self.SimpleClass(1), 'x'))
def test_update_none(self): self.assertThat( self.SimpleClass(1), MatchesStructure(x=Equals(1), y=NotEquals(42)).update(y=None))
def test_update(self): self.assertThat(self.SimpleClass(1), MatchesStructure(x=NotEquals(1)).update(x=Equals(1)))
def test_fromExample(self): self.assertThat(self.SimpleClass(1), MatchesStructure.fromExample(self.SimpleClass(1), 'x'))
def test_mismatch(self): self.assertRaises(AssertionError, self.assertThat, self.SimpleClass(1), MatchesStructure(x=NotEquals(1)))
def test_matches(self): self.assertThat(self.SimpleClass(1), MatchesStructure(x=Equals(1)))