-
Notifications
You must be signed in to change notification settings - Fork 567
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
Cleanup notebook.tex during PDF generation #768
Changes from all commits
3f93237
9ffb753
6bdba4f
2210f10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,11 @@ def test_constructor(self): | |
def test_export(self): | ||
"""Smoke test PDFExporter""" | ||
with tempdir.TemporaryDirectory() as td: | ||
newpath = os.path.join(td, os.path.basename(self._get_notebook())) | ||
file_name = os.path.basename(self._get_notebook()) | ||
newpath = os.path.join(td, file_name) | ||
shutil.copy(self._get_notebook(), newpath) | ||
(output, resources) = self.exporter_class(latex_count=1).from_filename(newpath) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd feel better if this test would run LaTeX with a bibfile since that can also introduce artifacts and should be tested as part of the smoke test. If this turns out to be too big of a change, then we can move this into a new PR & make a new issue. But, could you give that a shot? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can try to do that. Do you think it makes sense to copy these examples files into the repo for the test? https://github.com/jupyter/nbconvert-examples/tree/master/citations I can't seem to find an existing example notebook in this repo. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that those might be out of date — given that they were last updated over 3 years ago. I'm now thinking that there may be no built-in way to do this… which is… odd. We may need to look into the LaTeX templates to see if we need to include a new bibliography area and traitlet to get that to work. That's starting to sound like a separate PR though. Could you try to figure out if any of the other code related to this is dead? If you just include There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the code coverage, it seems like the only lines not executed in the PDF exporting are the win32 related, error related, or for generating the bib. I am not sure exactly when the code became dead, if there are other files that are affected. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Code coverage actually doesn't get exactly what I was looking for. My ultimate aim was to know which tests were using the bibliography functionality to see how it was being used. I can just do this myself though… There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Alright… so I'm fairly sure that right now that this code is only being run in the tests for the nbconvertapp, which are a gigantic pain to debug and investigate because they're hidden behind a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regardless my investigations left me believing that currently there is nothing that's properly testing the bibliography support… so we should look into that, but that's a separate PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good! I don't know much about bib support and haven't used it. |
||
self.assertIsInstance(output, bytes) | ||
assert len(output) > 0 | ||
|
||
# all temporary file should be cleaned up | ||
assert {file_name} == set(os.listdir(td)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice — that is cleaner.