Closed jinfu93 closed 2 years ago
@santiagohermo do feel free to add to this list or expand on the details of each test, thanks a lot!
Thanks @jinfu93! I made a couple of edits to the opening comment.
@santiagohermo I've added drafts of 2 tests: https://github.com/JMSLab/Template/blob/442eb18e64e6348e8768987c238b150b9140c874/source/lib/JMSLab/tests/test_autofill.py#L26-L44
Let me know if these look different from what you had in mind!
Regarding:
Make sure the behavior is as expected when using a string for format and a list with different formats.
I'm thinking of adding error handling to accommodate when autofill_formats
doesn't line up with autofill_lists
i.e. if autofill_lists
is a nested list but autofill_formats
is a string. Subsequently, the test can ensure the exception is thrown as expected. Let me know if you were thinking of something more straightforward than that.
I've also added a default for autofill_formats
in 1a52e3e as you suggested.
Thanks!
@santiagohermo implemented the following:
I'm thinking of adding error handling to accommodate when autofill_formats doesn't line up with autofill_lists i.e. if autofill_lists is a nested list but autofill_formats is a string. Subsequently, the test can ensure the exception is thrown as expected. Let me know if you were thinking of something more straightforward than that.
Thanks @jinfu93! On a first look the scripts look great. One small comment is that I'd try to not use sys.path.append
to import files in upstream folders. I'd use the approach here instead.
Feel free to move to PR and I'll make a more detailed review there.
Thanks @santiagohermo for the great tip! I attempted implementing the approach you suggested locally but was met with:
from ..autofill import GenerateAutofillMacros ImportError: attempted relative import with no known parent package
I also tried running locally the script source/lib/JMSLab/tests/test_build_lyx.py
that you referenced but got the same error. I'm wondering if you might have some idea about whether that's a potential setup/configuration issue on my end? Thanks!
Thanks @jinfu93! What was the working directory when you ran the script?
@santiagohermo I tried running it from both the root of Template and from the location of the script.
Can you try running it from source/lib/JMSLab
? When I run pytest
from that folder things seem to work fine.
Thanks @santiagohermo! I could run pytest
from sources/lib/JMSLab
but running the script itself without pytest
would still throw out the same error. Nonetheless, I could do some local testing with pytest
which is more than sufficient. Thanks again!
This thread continues in its PR #57.
Porting over from the sketch in #51 below are the additional tests we would like to implement in
test_autofill.py
:autofill_formats
is not specified?@santiagohermo do feel free to add to this list or expand on the details of each test, thanks a lot!