Ejemplo n.º 1
0
def test__do_parse_descriptionfile():
    tarballpath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               'resources/FooBar_0.99.1.tar.gz')
    pi = PackInfo(tarballpath)
    try:
        pi._do_parse_descriptionfile('/some/invalid/DESCRIPTION')
        pytest.fail('Calling the method that way must raise an Exception!')
    except Exception:
        pass
Ejemplo n.º 2
0
def test_dependencies():
    path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                        'resources', 'FooBar')
    pi = PackInfo(path)
    assert (len(pi.dependencies(withBasePackages=True)) == 4)
    assert ('methods' in pi.dependencies(withBasePackages=True))
    assert ('utils' in pi.dependencies(withBasePackages=True))
    assert ('toto' in pi.dependencies(withBasePackages=True))
    assert ('R' in pi.dependencies(withBasePackages=True))
    assert (len(pi.dependencies()) == 1)
    assert ('toto' in pi.dependencies())
Ejemplo n.º 3
0
def test__parse_package_name_version():
    # invalid extension
    try:
        PackInfo._parse_package_name_version('/some/path/name_0.1.0.zip')
        pytest.fail('An exception was expected!')
    except Exception:
        pass
    # invalid name
    try:
        PackInfo._parse_package_name_version('/some/path/name-0.1.0.tar.gz')
        pytest.fail('An exception was expected!')
    except Exception:
        pass
    # correct name
    name, version = PackInfo._parse_package_name_version(
        '/some/path/name_0.1.0.tar.gz')
    assert (name == 'name')
    assert (version == '0.1.0')
Ejemplo n.º 4
0
 def __init__(self, path):
     self.name, self.version = PackInfo._parse_package_name_version(path)
     self.status = None
     self.fullstatus = None
     self.repos = None
     self.depends = None
     self.imports = None
     self.suggests = None
     self.license = None
Ejemplo n.º 5
0
def test_constructor_invalid_packagetarball():
    tarballpath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               'resources/nonexistingpackage_0.99.1.tar.gz')
    try:
        PackInfo(tarballpath)
    except Exception:
        pytest.fail('Constructing a packInfo with '
                    'an invalid tarball must raise an Exception!')
    except Exception:
        pass
Ejemplo n.º 6
0
def test_constructor_packagefolder():
    path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                        'resources', 'FooBar')
    pi = PackInfo(path)
    print(pi.as_dict)
    assert (pi.name == 'FooBar')
    assert (pi.version == '0.99.1')
    assert (pi.depends == ['R'])
    assert (pi.imports == ['methods', 'utils', 'toto'])
    assert (pi.suggests == ['Rtoto', 'Rtiti', 'Rtata'])
    assert (pi.license == 'GPL-2 and some blahblah')
Ejemplo n.º 7
0
def test_constructor_packagetarball():
    tarballpath = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                               'resources/FooBar_0.99.1.tar.gz')
    pi = PackInfo(tarballpath)
    print(pi.as_dict)
    assert (pi.name == 'FooBar')
    assert (pi.version == '0.99.1')
    assert (pi.depends == ['R'])
    assert (pi.imports == ['methods', 'utils'])
    assert (pi.suggests == ['Rtoto', 'Rtiti'])
    assert (pi.license == 'GPL-2')
Ejemplo n.º 8
0
def test__parse_linkingto():
    path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                        'resources', 'bindrcpp')
    pi = PackInfo(path)
    print(pi.as_dict)
    assert (pi.name == 'bindrcpp')
    assert (pi.version == '0.2.2.9000')
    assert (pi.imports == ['bindr', 'Rcpp'])
    assert (pi.suggests == ['testthat'])
    assert (pi.linkingto == ['plogr', 'Rcpp'])
    assert (pi.license == 'MIT + file LICENSE')
Ejemplo n.º 9
0
def test__parse_license():
    path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                        'resources', 'FooBarZoo')
    pi = PackInfo(path)
    print(pi.as_dict)
    assert (pi.name == 'FooBar')
    assert (pi.version == '0.99.1')
    assert (pi.depends == ['R'])
    assert (pi.imports == ['methods', 'utils', 'toto'])
    assert (pi.suggests == ['Rtoto', 'Rtiti', 'Rtata'])
    assert (pi.license == 'AGPL-3 | file LICENSE')
    assert (pi.installationisallowed is False)
Ejemplo n.º 10
0
def test_has_imports():
    path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                        'resources', 'FooBar')
    pi = PackInfo(path)
    assert (pi.has_imports)
Ejemplo n.º 11
0
def test_tarball():
    path = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                        'resources', 'FooBar')
    pi = PackInfo(path)
    assert (pi.tarball == 'FooBar_0.99.1.tar.gz')