How to use the pipreqs.pipreqs.get_imports_info function in pipreqs

To help you get started, we’ve selected a few pipreqs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_get_imports_info(self):
        """
        Test to see that the right number of packages were found on PyPI
        """
        imports = pipreqs.get_all_imports(self.project)
        with_info = pipreqs.get_imports_info(imports)
        # Should contain 10 items without the "nonexistendmodule" and "after_method_is_valid_even_if_not_pep8"
        self.assertEqual(len(with_info), 11)
        for item in with_info:
            self.assertTrue(
                item['name'].lower() in self.modules,
                "Import item appears to be missing " + item['name'])