예제 #1
0
    def test_package_1(self, shared_datadir):
        test_file = "Acme-mac-4.1.tar.gz"
        p1 = Package(shared_datadir / test_file)

        assert p1.name == "Acme"
        assert p1.version == "4.1.0.2.0"
        assert p1.filename == test_file
        assert p1.platform == "mac"
        assert p1.channel == "stable"
        assert p1.info["status"] is True
예제 #2
0
    def test_package_name_with_spaces(self, shared_datadir):
        test_file = "with spaces-nix-0.0.1b1.zip"
        p1 = Package(shared_datadir / test_file)

        assert p1.name == "with spaces"
        assert p1.version == "0.0.1.1.1"
        assert p1.filename == test_file
        assert p1.platform == "nix"
        assert p1.channel == "beta"
        assert p1.info["status"] is True
예제 #3
0
    def test_package_alpha(self, shared_datadir):
        test_file = "with spaces-win-0.0.1a2.zip"
        p1 = Package(shared_datadir / test_file)

        assert p1.name == "with spaces"
        assert p1.version == "0.0.1.0.2"
        assert p1.filename == test_file
        assert p1.platform == "win"
        assert p1.channel == "alpha"
        assert p1.info["status"] is True
예제 #4
0
    def test_package_1(self, shared_datadir):
        test_file = 'Acme-mac-4.1.tar.gz'
        p1 = Package(shared_datadir / test_file)

        assert p1.name == 'Acme'
        assert p1.version == '4.1.0.2.0'
        assert p1.filename == test_file
        assert p1.platform == 'mac'
        assert p1.channel == 'stable'
        assert p1.info['status'] is True
예제 #5
0
    def test_package_bad_extension(self, shared_datadir):
        test_file_2 = "pyu-win-0.0.2.xz"
        p2 = Package(shared_datadir / test_file_2)

        assert p2.filename == test_file_2
        assert p2.name is None
        assert p2.version is None
        assert p2.info["status"] is False
        assert p2.info["reason"] == ("Not a supported archive format: "
                                     "{}".format(test_file_2))
예제 #6
0
    def test_package_bad_extension(self, shared_datadir):
        test_file_2 = 'pyu-win-0.0.2.xz'
        p2 = Package(shared_datadir / test_file_2)

        assert p2.filename == test_file_2
        assert p2.name is None
        assert p2.version is None
        assert p2.info['status'] is False
        assert p2.info['reason'] == ('Not a supported archive format: '
                                     '{}'.format(test_file_2))
예제 #7
0
    def test_package_alpha(self, shared_datadir):
        test_file = 'with spaces-win-0.0.1a2.zip'
        p1 = Package(shared_datadir / test_file)

        assert p1.name == 'with spaces'
        assert p1.version == '0.0.1.0.2'
        assert p1.filename == test_file
        assert p1.platform == 'win'
        assert p1.channel == 'alpha'
        assert p1.info['status'] is True
예제 #8
0
    def test_package_name_with_spaces(self, shared_datadir):
        test_file = 'with spaces-nix-0.0.1b1.zip'
        p1 = Package(shared_datadir / test_file)

        assert p1.name == 'with spaces'
        assert p1.version == '0.0.1.1.1'
        assert p1.filename == test_file
        assert p1.platform == 'nix'
        assert p1.channel == 'beta'
        assert p1.info['status'] is True
예제 #9
0
    def test_patch(self, patch_setup):
        filename = "Acme-mac-4.2.tar.gz"

        with ChDir(self.new_dir):
            full_path = os.path.abspath(filename)
            pkg = Package(full_path)

        config = {}
        version_data = {}
        data = {
            "filename": full_path,
            "files_dir": self.files_dir,
            "new_dir": self.new_dir,
            "json_data": version_data,
            "pkg_info": pkg,
            "config": config,
            "test": True,
        }

        patch = Patch(**data)

        assert patch.ok
        assert config["patches"][pkg.name]
예제 #10
0
    def test_patch(self, patch_setup):
        filename = 'Acme-mac-4.2.tar.gz'

        with ChDir(self.new_dir):
            full_path = os.path.abspath(filename)
            pkg = Package(full_path)

        config = {}
        version_data = {}
        data = {
            'filename': full_path,
            'files_dir': self.files_dir,
            'new_dir': self.new_dir,
            'json_data': version_data,
            'pkg_info': pkg,
            'config': config,
            'test': True
        }

        patch = Patch(**data)

        assert patch.ok
        assert config['patches'][pkg.name]
예제 #11
0
 def test_package_bad_platform(self, shared_datadir):
     filename = "pyu-wi-1.1.tar.gz"
     p = Package(shared_datadir / filename)
     out = "Package platform not formatted correctly"
     assert p.info["reason"] == out
예제 #12
0
 def test_package_bad_version(self, shared_datadir):
     filename = "pyu-win-1.tar.gz"
     p = Package(shared_datadir / filename)
     out = "Package version not formatted correctly: {}"
     assert p.info["reason"] == out.format(filename)
예제 #13
0
 def test_package_ignored_file(self):
     with io.open(".DS_Store", "w", encoding="utf-8") as f:
         f.write("")
     p = Package(".DS_Store")
     assert p.info["status"] is False
예제 #14
0
 def test_package_bad_platform(self, shared_datadir):
     filename = 'pyu-wi-1.1.tar.gz'
     p = Package(shared_datadir / filename)
     out = 'Package platform not formatted correctly'
     assert p.info['reason'] == out
예제 #15
0
 def test_package_bad_version(self, shared_datadir):
     filename = 'pyu-win-1.tar.gz'
     p = Package(shared_datadir / filename)
     out = 'Package version not formatted correctly: {}'
     assert p.info['reason'] == out.format(filename)
예제 #16
0
 def test_package_ignored_file(self):
     with io.open('.DS_Store', 'w', encoding='utf-8') as f:
         f.write('')
     p = Package('.DS_Store')
     assert p.info['status'] is False