Exemple #1
0
    def test_nested_constraints_file(self, monkeypatch, tmpdir):
        req_name = 'hello'
        req_file = tmpdir / 'parent' / 'req_file.txt'
        req_file.parent.mkdir()
        req_file.write_text('-c reqs.txt')
        req_file.parent.joinpath('reqs.txt').write_text(req_name)

        monkeypatch.chdir(str(tmpdir))

        reqs = list(parse_reqfile('./parent/req_file.txt', session=session))
        assert len(reqs) == 1
        assert reqs[0].name == req_name
        assert reqs[0].constraint
Exemple #2
0
    def test_nested_constraints_file(self, monkeypatch: pytest.MonkeyPatch,
                                     tmpdir: Path,
                                     session: PipSession) -> None:
        req_name = "hello"
        req_file = tmpdir / "parent" / "req_file.txt"
        req_file.parent.mkdir()
        req_file.write_text("-c reqs.txt")
        req_file.parent.joinpath("reqs.txt").write_text(req_name)

        monkeypatch.chdir(str(tmpdir))

        reqs = list(parse_reqfile("./parent/req_file.txt", session=session))
        assert len(reqs) == 1
        assert reqs[0].name == req_name
        assert reqs[0].constraint
Exemple #3
0
    def test_relative_local_nested_req_files(self, session, monkeypatch,
                                             tmpdir):
        """
        Test a relative nested req file path is joined with the req file dir
        """
        req_name = 'hello'
        req_file = tmpdir / 'parent' / 'req_file.txt'
        req_file.parent.mkdir()
        req_file.write_text('-r reqs.txt')
        req_file.parent.joinpath('reqs.txt').write_text(req_name)

        monkeypatch.chdir(str(tmpdir))

        reqs = list(parse_reqfile('./parent/req_file.txt', session=session))
        assert len(reqs) == 1
        assert reqs[0].name == req_name
        assert not reqs[0].constraint
Exemple #4
0
    def test_relative_local_nested_req_files(self, session: PipSession,
                                             monkeypatch: pytest.MonkeyPatch,
                                             tmpdir: Path) -> None:
        """
        Test a relative nested req file path is joined with the req file dir
        """
        req_name = "hello"
        req_file = tmpdir / "parent" / "req_file.txt"
        req_file.parent.mkdir()
        req_file.write_text("-r reqs.txt")
        req_file.parent.joinpath("reqs.txt").write_text(req_name)

        monkeypatch.chdir(str(tmpdir))

        reqs = list(parse_reqfile("./parent/req_file.txt", session=session))
        assert len(reqs) == 1
        assert reqs[0].name == req_name
        assert not reqs[0].constraint
Exemple #5
0
    def test_absolute_local_nested_req_files(self, session, monkeypatch,
                                             tmpdir):
        """
        Test an absolute nested req file path
        """
        req_name = 'hello'
        req_file = tmpdir / 'parent' / 'req_file.txt'
        req_file.parent.mkdir()
        other_req_file = tmpdir / 'other' / 'reqs.txt'
        other_req_file.parent.mkdir()
        # POSIX-ify the path, since Windows backslashes aren't supported.
        other_req_file_str = str(other_req_file).replace('\\', '/')

        req_file.write_text('-r {}'.format(other_req_file_str))
        other_req_file.write_text(req_name)

        reqs = list(parse_reqfile(str(req_file), session=session))
        assert len(reqs) == 1
        assert reqs[0].name == req_name
        assert not reqs[0].constraint
Exemple #6
0
    def test_absolute_local_nested_req_files(self, session: PipSession,
                                             tmpdir: Path) -> None:
        """
        Test an absolute nested req file path
        """
        req_name = "hello"
        req_file = tmpdir / "parent" / "req_file.txt"
        req_file.parent.mkdir()
        other_req_file = tmpdir / "other" / "reqs.txt"
        other_req_file.parent.mkdir()
        # POSIX-ify the path, since Windows backslashes aren't supported.
        other_req_file_str = str(other_req_file).replace("\\", "/")

        req_file.write_text(f"-r {other_req_file_str}")
        other_req_file.write_text(req_name)

        reqs = list(parse_reqfile(str(req_file), session=session))
        assert len(reqs) == 1
        assert reqs[0].name == req_name
        assert not reqs[0].constraint