Ejemplo n.º 1
0
    def test_will_return_none_if_proxy_no_specified(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT_WITH_LINUX_AND_ALL_PACKAGES)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertFalse(config.has_http_proxy())
        self.assertEqual(config.http_proxy(), None)
Ejemplo n.º 2
0
    def test_will_read_proxy_from_file(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertTrue(config.has_http_proxy())
        self.assertEqual(config.http_proxy(), 'http://192.168.1.2:9000')
Ejemplo n.º 3
0
    def test_willReadWindowsPackagesFromFile(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT_WITH_WINDOWS_AND_ALL_PACKAGES)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertNotEquals(packages['qt'], None)
        self.assertNotEquals(packages['json'], None)
        self.assertNotEquals(packages['Which'], None)
Ejemplo n.º 4
0
    def test_willInterpretSingleRemoteLocationAsListWithOSSearchesAdded(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT_WITH_ONLY_ONE_REMOTE_LOCATION)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertEquals(config['remote-locations'],
                          [os.path.join('/opt', 'centos7', 'i386'), os.path.join('/opt', 'rhel7', 'i386'),
                           os.path.join('/opt', 'centos7'), os.path.join('/opt', 'rhel7'), '/opt'])
Ejemplo n.º 5
0
    def test_wilAddSearchPathsBasedOnWindowsAndArch(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertEquals(config['remote-locations'],
                          [os.path.join('/opt', 'win32', 'x86_64'), os.path.join('/opt', 'win32'), '/opt',
                           os.path.join('http://github.com', 'win32', 'x86_64'),
                           os.path.join('http://github.com', 'win32'), 'http://github.com'])
Ejemplo n.º 6
0
    def test_willReadPackagesFromFile(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertNotEquals(packages['qt'], None)
        self.assertNotEquals(packages['json'], None)
        self.assertNotEquals(packages['Which'], None)
        self.assertNotEquals(packages['git-python'], None)
        self.assertNotEquals(packages['x11'], None)
Ejemplo n.º 7
0
    def test_willReadTypeFromFile(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertEquals(packages['qt']['destination'], 'dependency-lib')
        self.assertEquals(packages['json']['destination'], 'dependency-lib')
        self.assertEquals(packages['Which']['destination'], 'bin')
        self.assertEquals(packages['git-python']['destination'], 'python-site-packages')
        self.assertEquals(packages['x11']['destination'], 'dependency-lib')
Ejemplo n.º 8
0
    def test_willReadTypeFromFile(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertEquals(packages['qt']['type'], 'rpm')
        self.assertEquals(packages['json']['type'], 'archive')
        self.assertEquals(packages['Which']['type'], 'perl')
        self.assertEquals(packages['git-python']['type'], 'python')
        self.assertEquals(packages['x11']['type'], 'rpm')
Ejemplo n.º 9
0
    def test_willReadVersionFromFile(self):
        self.fs.CreateFile('devenv.yaml', contents=SAMPLE_CONTENT)

        (config, packages) = reader.devenv_from_file('devenv.yaml')

        self.assertEquals(packages['qt']['version'], '4.8.6')
        self.assertEquals(packages['json']['version'], '1.8')
        self.assertEquals(packages['Which']['version'], 'latest')
        self.assertEquals(packages['git-python']['version'], 'latest')
        self.assertEquals(packages['x11']['version'], 'latest')
Ejemplo n.º 10
0
    def test_will_remove_archive_packages_that_have_been_removed(self, mock_subprocess, mock_pip_runner):
        self.setup_files(DIFFERENT_SAMPLE_YAML_CONTENT, SAMPLE_CACHE_CONTENT)
        self.create_package('qt')
        self.create_package('json')
        cache = PackageCache('myProject', self._base_path)
        (config, packages) = reader.devenv_from_file(self._yaml_file)

        uninstaller = PackageUninstaller(cache, packages, mock_pip_runner)
        uninstaller.uninstall_changed_packages()

        self.assertFalse(os.path.exists(os.path.join(self._deps, 'json')))
Ejemplo n.º 11
0
    def test_will_call_pip_for_removed_system_packages(self, mock_subprocess, mock_pip_runner):
        self.setup_files(DIFFERENT_SAMPLE_YAML_CONTENT, SAMPLE_CACHE_CONTENT)
        self.create_package('qt')
        self.create_package('json')
        cache = PackageCache('myProject', self._base_path)
        (config, packages) = reader.devenv_from_file(self._yaml_file)

        uninstaller = PackageUninstaller(cache, packages, mock_pip_runner)
        uninstaller.uninstall_changed_packages()

        mock_pip_runner.remove.assert_called_once_with('git-python', '0.3.10')
Ejemplo n.º 12
0
    def test_will_replace_prefix_variable_in_all_pc_files(self):
        self.setup_files(SAMPLE_YAML_CONTENT, SAMPLE_CACHE_CONTENT)
        self.create_dependency_directory(os.path.join('qt', 'lib'))
        self.create_dependency_directory(os.path.join('qt', 'lib', 'pkgconfig'))
        self.create_dependency_file(os.path.join('qt', 'lib', 'pkgconfig', 'Qt5Core.pc'), SAMPLE_PKG_CONFIG_FILE)

        cache = PackageCache('myProject', self._base_path)
        (_, packages) = reader.devenv_from_file(self._yaml_file)

        PkgConfigProcessor.replace_prefix(cache.install_locations('qt'), packages['qt']['pkg-config'])

        with open(os.path.join(self._deps, 'qt', 'lib', 'pkgconfig', 'Qt5Core.pc')) as f:
            replaced_pkg_config_data = f.readlines()

        self.assertEqual(''.join(replaced_pkg_config_data), EXPECTED_SAMPLE_PKG_CONFIG_FILE)
Ejemplo n.º 13
0
 def test_will_exit_if_yaml_file_does_not_exist(self):
     with self.assertRaises(SystemExit):
         reader.devenv_from_file('unknown.yaml')