Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot pass existing temporary directory to TemporaryPostgres #698

Open
lilyminium opened this issue Nov 14, 2021 · 0 comments
Open

Cannot pass existing temporary directory to TemporaryPostgres #698

lilyminium opened this issue Nov 14, 2021 · 0 comments

Comments

@lilyminium
Copy link

Thanks for having a look at the other bugs I raised, @bennybp! I put off raising this one because I haven't put together a MRE, but I think if you inspect the code then the issue becomes clear.

Describe the bug

I cannot pass a tmpdir into TemporaryPostgres because:

  1. TemporaryPostgres assumes tmpdir has a name attribute
  2. TemporaryPostgres assumes the name attribute is the absolute path / TemporaryPostgres does not account for directories that are not within the current working directory.

To Reproduce

Both behaviours are down to this line:

config_data = {"port": find_port(), "directory": self._db_tmpdir.name}

.name for a pathlib.Path only gives the last portion of the path, i.e.

>>> import pathlib
>>> path = pathlib.Path("/Users/lily/anaconda")
>>> path.name
'anaconda'

And of course strings do not have .names (the documented type is Optional[str]).

Expected behavior

I can give either a string or a path.

Additional context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant