Change canonical-data reference to improve version checking
See original GitHub issueFrom @AnAccountForReportingBugs in https://github.com/exercism/python/issues/1726#issuecomment-475787036
[referencing these changes] This one took a bit to figure out. May want to loosen the regex or change how the comment looks.
Another idea is to you use a module level doc string or a global variable in the various _test.py files. This would allow direct access to the string using various techniques.
And from @cmccandless in https://github.com/exercism/python/issues/1726#issuecomment-476205579
I’ve run into this before where the ‘v’ was missing on the version reference in a test suite. I’d rather add a check somewhere that enforces one of the following than allow too much variation in the reference:
- Tests based on problem-specifications//canonical-data.json @ v1.2.3`
- No canonical-data.json for this exercise
I like the docstring idea. It would simplify some things.
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (10 by maintainers)
Top GitHub Comments
Ahh, hadn’t considered that this was a contributor-facing bit of boilerplate. I’ll rescind that point for any future PR, but maybe if it said “CONTRIBUTORS: this file was automatically generated from {path to .meta/template.j2}: please do not edit this file directly” or something similar?
Either way, closing this one … from the above I’m not aware of a specific offending script in our repo to remove.
I don’t dislike the idea of a bit of “Automatically generated” boilerplate on tests, though I’d maybe drop the admonition not to edit the file… we don’t actually mind them adding new tests, if it helps them. I’m not sure any of the other languages add licensure or copyright boilerplate to any of the files usually distributed through the exercism CLI … that would really be a call for @kytrinyx and @iHiD to make. But I’d be happy to get a PR adding something about automatic generation to the config/master_template.j2 or config/generator_macros.j2 files.
That said, that’s a separate discussion from this issue’s concerns, which I think have been mooted by the move of (virtually all) exercises to automatic generation … we no longer need to do any sort of work to parse the version for an explicit check, we just need to generate from latest and see if there’s a diff, plus if we do need to parse it there’s now a consistent string to do that from, since it’s generated via the template.
So personally I think we can just close this, since it was created before we did the big push towards generation. @cmccandless ?