How to use pipreqs - 10 common examples

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_init_savepath(self):
        """
        Test that we can save requiremnts.tt correctly to a different path
        """
        pipreqs.init({'
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_init(self):
        """
        Test that all modules we will test upon, are in requirements file
        """
        pipreqs.init({'
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_init_overwrite(self):
        """
        Test that if requiremnts.txt exists, it will not automatically be overwritten
        """
        with open(self.requirements_path, "w") as f:
            f.write("should_not_be_overwritten")
        pipreqs.init({'
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_ignored_directory(self):
        """
        Test --ignore parameter
        """
        pipreqs.init(
            {'
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_init_local_only(self):
        """
        Test that items listed in requirements.text are the same as locals expected
        """
        pipreqs.init({'
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'])
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_deduplicate_dependencies(self):
        imports = pipreqs.get_all_imports(self.project_with_duplicated_deps)
        pkgs = pipreqs.get_pkg_names(imports)
        self.assertEqual(len(pkgs), 1)
        self.assertTrue("pymongo" in pkgs)
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_get_all_imports(self):
        imports = pipreqs.get_all_imports(self.project)
        self.assertEqual(len(imports), 13)
        for item in imports:
            self.assertTrue(
                item.lower() in self.modules, "Import is missing: " + item)
        self.assertFalse("time" in imports)
        self.assertFalse("logging" in imports)
        self.assertFalse("curses" in imports)
        self.assertFalse("__future__" in imports)
        self.assertFalse("django" in imports)
        self.assertFalse("models" in imports)
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_deduplicate_dependencies(self):
        imports = pipreqs.get_all_imports(self.project_with_duplicated_deps)
        pkgs = pipreqs.get_pkg_names(imports)
        self.assertEqual(len(pkgs), 1)
        self.assertTrue("pymongo" in pkgs)
github bndr / pipreqs / tests / test_pipreqs.py View on Github external
def test_get_use_local_only(self):
        """
        Test without checking PyPI, check to see if names of local imports matches what we expect

        - Note even though pyflakes isn't in requirements.txt,
          It's added to locals since it is a development dependency for testing
        """
        # should find only docopt and requests
        imports_with_info = pipreqs.get_import_local(self.modules)
        for item in imports_with_info:
            self.assertTrue(item['name'].lower() in self.local)