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

can a doctest depend on an external file? #1653

Closed
rkurchin opened this issue Jul 20, 2021 · 6 comments
Closed

can a doctest depend on an external file? #1653

rkurchin opened this issue Jul 20, 2021 · 6 comments

Comments

@rkurchin
Copy link

I want to have a doctest demonstrating how to read in an object from a file, but I can't figure out how to specify the path to the file. I've tried putting a cd in the setup line but that errors in a somewhat opaque way. I created a dummy test that just runs pwd() to try to figure out where they're actually running but it prints a blank line. Is what I'm trying to do even possible?

@fredrikekre
Copy link
Member

pwd() should be the output directory.

@rkurchin
Copy link
Author

Could this have something to do with the fact that I'm trying to build the docs locally but they're set up to deploy online? There are a variety of approaches for doing that in #1413; would that matter? I can try to make an MWE for this but it would take awhile to figure out how to do...

@fredrikekre
Copy link
Member

Maybe you are experiencing #921

@rkurchin
Copy link
Author

I don't think so; it works fine if I specify an absolute path on my local system. But that obviously won't work for deployment purposes. I just need some way to figure out in what directory the doctests are actually running, but I don't know how to do that since pwd() doesn't print anything...

@fredrikekre
Copy link
Member

figure out in what directory the doctests are actually running

It should be the output directory of the markdown (well, html) file.

since pwd() doesn't print anything...

Hmm, thats strange

@rkurchin
Copy link
Author

Okay, so I was trying to make an MWE and the issue seems to have gone away. I have no idea what changed; I didn't even restart my REPL or anything. Sorry for the bother! 🤷‍♀️

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

No branches or pull requests

3 participants