def test_multiple_requirements_files(self): with tempfile.NamedTemporaryFile('w') as f1: f1.write(EXAMPLE_REQUIREMENTS) f1.flush() with tempfile.NamedTemporaryFile('w') as f2: f2.write(EXAMPLE_EXTRA_REQUIREMENTS) f2.flush() got = ciu_main.projects_from_requirements([f1.name, f2.name]) want = self.expected_requirements.union(self.expected_extra_requirements) self.assertEqual(set(got), want)
def check(requirements_paths=[], metadata=[], projects=[]): """Return True if all of the specified dependencies have been ported to Python 3. The requirements_paths argument takes a sequence of file paths to requirements files. The 'metadata' argument takes a sequence of strings representing metadata. The 'projects' argument takes a sequence of project names. Any project that is not listed on PyPI will be considered ported. """ dependencies = main.projects_from_requirements(requirements_paths) dependencies.extend(main.projects_from_metadata(metadata)) dependencies.extend(projects) dependencies = set(name.lower() for name in dependencies) pypy_projects = pypi.all_pypy_projects() all_projects = pypi.all_projects() for dependency in dependencies: if dependency in all_projects and dependency not in pypy_projects: if not pypi.is_pure_python(dependency): return False return True
def test_requirements(self): with tempfile.NamedTemporaryFile('w') as file: file.write(EXAMPLE_REQUIREMENTS) file.flush() got = ciu_main.projects_from_requirements([file.name]) self.assertEqual(set(got), self.expected_requirements)