def test_cli_for_metadata(self): with tempfile.NamedTemporaryFile('w') as file: file.write(EXAMPLE_METADATA) file.flush() args = ['--metadata', file.name] parsed = ciu_main.arguments_from_cli(args) got = ciu_main.projects_from_parsed(parsed) self.assertEqual(set(got), self.expected_metadata)
def test_cli_for_requirements(self): with tempfile.NamedTemporaryFile('w') as file: file.write(EXAMPLE_REQUIREMENTS) file.flush() args = ['--requirements', file.name] parsed = ciu_main.arguments_from_cli(args) got = ciu_main.projects_from_parsed(parsed) self.assertEqual(set(got), self.expected_requirements)
def test_excluding_requirements(self): with tempfile.NamedTemporaryFile('w') as file: file.write(EXAMPLE_REQUIREMENTS) file.flush() args = ['--requirements', file.name, '--exclude', 'pickything'] parsed = ciu_main.arguments_from_cli(args) got = ciu_main.projects_from_parsed(parsed) expected_requirements = set(self.expected_requirements) expected_requirements.remove('pickything') self.assertNotIn('pickything', set(got)) self.assertEqual(set(got), expected_requirements)
def test_verbose_output(self): ciu_main.arguments_from_cli(['-v', '-p', 'ipython']) self.assertTrue(logging.getLogger('ciu').isEnabledFor(logging.INFO))
def test_projects_must_be_specified(self, parser_error): ciu_main.arguments_from_cli([]) self.assertEqual( mock.call("Missing 'requirements', 'metadata', or 'projects'"), parser_error.call_args)
def test_cli_for_index_default(self): args = ['--projects', 'foo', 'bar.baz'] parsed = ciu_main.arguments_from_cli(args) self.assertEqual(parsed.index, 'https://pypi.org/pypi')
def test_cli_for_index(self): args = ['--projects', 'foo', 'bar.baz', '--index', 'some-url'] parsed = ciu_main.arguments_from_cli(args) self.assertEqual(parsed.index, 'some-url')
def test_cli_for_projects(self): args = ['--projects', 'foo', 'bar.baz'] parsed = ciu_main.arguments_from_cli(args) got = ciu_main.projects_from_parsed(parsed) self.assertEqual(set(got), frozenset(['foo', 'bar-baz']))