pyupio/dparse

test_update_pipfile fails with pipenv >= 11.10.2

knobix opened this issue · 1 comments

  • Dependency Parser version: 0.4.1
  • Python version: 3.6.9
  • Operating System: FreeBSD 11.2-RELEASE amd64

Description

When testing with pytest -v -rs the test test_update_pipfile in test_updater.py fails with a TypeError. (see below for an output of the relevant lines).

What I Did

Tried to find the root cause. With pipenv <= 11.10.1 all tests succeed, with pipenv >= 11.10.2 the mentioned test fail. This might be caused by the following line:

Possible root cause

There the self.pipfile_location variable is set to None which leads then to the failure.

As pipenv is an optional dependency, maybe it makes also sense to generate a XFAIL if the component isn't installed.

[...]
>       new_content = PipfileUpdater.update(content, version="2.1", dependency=dep)

tests/test_updater.py:460: 
_ _ _ _ _ _ _ _ _ _ _ 
dparse/updater.py:95: in update
    p.write_toml(data=data, path=pipfile.name)
/usr/local/lib/python3.6/site-packages/pipenv/project.py:823: in write_toml
    == vistir.compat.Path(self.pipfile_location).absolute()
/usr/local/lib/python3.6/pathlib.py:1001: in __new__
    self = cls._from_parts(args, init=False)
/usr/local/lib/python3.6/pathlib.py:656: in _from_parts
    drv, root, parts = self._parse_args(args)
_ _ _ _ _ _ _ _ _ _ _ 

cls = <class 'pathlib.PosixPath'>, args = (None,)

    @classmethod
    def _parse_args(cls, args):
        # This is useful when you don't want to create an instance, just
        # canonicalize some constructor arguments.
        parts = []
        for a in args:
            if isinstance(a, PurePath):
                parts += a._parts
            else:
>               a = os.fspath(a)
E               TypeError: expected str, bytes or os.PathLike object, not NoneType

Not happening on latest version. Let us know if you still need help with this.