summaryrefslogtreecommitdiff
path: root/subplot.py
AgeCommit message (Collapse)AuthorFilesLines
2023-06-01chore: drop now-unused step for sleeping for a secondLars Wirzenius1-5/+0
This was always a kludge, and we no longer use it anywhere, so offski with it. May it never return! Nac Mac Feegle! The Wee Free Men! Nae sleep! Nae wait! We willna' be slowed again! Sponsored-by: author
2021-08-14test: query Cargo for its target directoryLars Wirzenius1-23/+6
Run "cargo metadata" to get the location of the Cargo "target" directory. The location of the directory is configurable by the user, so we can't assume it's "target" in the source tree. It turned out that running "cargo metadata" in a scenario didn't work well, because cargo wants to use some files from the user's home directory, and for scenarios, that's changed (by setting $HOME). To work around this, the generated test program now requires SUBPLOT_DIR to be set when running the generated Python test programs. The "./check" script does that. Sponsored-by: author
2021-05-01subplot: Add delay step in some scenariosDaniel Silverstone1-0/+5
In order to work on filesystems where the time granularity is not sub-second, some scenarios need to wait a bit. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-04-24Merge branch 'pylog' into 'main'Daniel Silverstone1-3/+0
chore: clean up log files from generated Python programs See merge request larswirzenius/subplot!150
2021-04-24subplot.md: Document scenario language a bit moreDaniel Silverstone1-0/+4
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-04-23chore: clean up log files from generated Python programsLars Wirzenius1-3/+0
This is a step in the right direction, but may not be enough. We'll see. Multi-line log messages are no multiple lines in in the log file. All but the first one are indented. Dictionaries are listed with one key per line. argv as one item per line. Various log messages that are just noise removed.
2021-04-09testing: Rework sp-{doc,code}gen into subplot {doc,code}gen in testsDaniel Silverstone1-3/+3
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-02-13feat: allow subplot.md to be used to test an installed SubplotLars Wirzenius1-14/+27
2021-01-10check: Cope with non-embedded resources by passing --resources to docgenDaniel Silverstone1-5/+6
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2021-01-10resource: Switch from 'templates' to 'share'Daniel Silverstone1-1/+1
In a general sense, we will want to have more than just template files as resources. This shifts from the concept that the only thing resource-wise that subplot has is templates, to a more general shared resources concept without a default path beyond CWD. Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-10-01fix: add wrapper to add -t option to sp-codegen, when run by subplotLars Wirzenius1-0/+30
This allows the tests to add the option to use the templates from the source tree, and don't use an installed Subplot, or require one to be installed.
2020-09-28refactor(subplot.{py,yaml}): use steps/functions from lib/runcmdLars Wirzenius1-103/+0
Drop the (many) steps and step functions to run Subplot binaries and use the ones from lib/runcmd instead
2020-09-28fix(subplot.{md,py,yaml}): run Subplot binaries from the source treeLars Wirzenius1-0/+6
This is akin to installing them to a directory in PATH. Instead of doing that, we amend PATH so that the directory in the source tree with the binaries are in there. This adds a "given an installed subplot" step to every scenario that needs to run a Subplot binary.
2020-09-28refactor(subplot.{md,py,yaml}): use step functions from lib/runcmd.pyLars Wirzenius1-57/+58
Use the Python functions from lib/runcmd.py instead of the ones from ./runcmd.py. This changes some bindings in subplot.yaml to use functions from lib/runcmd.py, and changes some step functions in subplot.py to be defined in terms of functions in lib/runcmd.py. The actual steps in subplot.md are not changed and no bindings from lib/runcmd.yaml are yet used. Some bindings that used to come from runcmd.yaml are here added to subplot.yaml. This is temporary change that will be undone later by replacing those bindings with ones from lib/runcmd.yaml, but doing that in this commit would make it bigger and harder to follow.
2020-09-26fix(subplot.py): make lintableLars Wirzenius1-3/+49
While this module is intended to be inserted into the Subplot Python template, and it works, it's not cleanly lintable, as the linters don't understand about the template. Fix this by retrieving any symbols used from the template via the globals() dict.
2020-06-08feat: add sp-extract for extracting data files from subplotsLars Wirzenius1-0/+6
2020-05-24test: add scenarios to verify newline adding to embedded filesLars Wirzenius1-0/+19
2020-05-24test(sp-meta): amend scenario to also test JSON outputLars Wirzenius1-0/+13
2020-05-20refactor: move things from subplot.{py,yaml} to separate filesLars Wirzenius1-131/+14
files.{py,yaml} contain re-usable steps for handling files. runcmd.{py,yaml} contain re-usable steps for running commands and inspecting results.
2020-05-17feat(subplot.md): add acceptance criteria for cleanup functionalityLars Wirzenius1-4/+26
Add acceptance checks for the cleanup functionality, for Python and Bash templates.
2020-05-16refactor: format subplot.py with blackLars Wirzenius1-67/+87
We use rustfmt for Rust code. Black is the corresponding tool for Python code.
2020-05-08subplot.py: Add stderr functions like stdout onesDaniel Silverstone1-0/+16
Signed-off-by: Daniel Silverstone <dsilvers@digital-scurf.org>
2020-05-08Add: scenarios for test programs running only chosen scenariosLars Wirzenius1-3/+28
2020-05-02Change: produce docgen output if missing or older than any sourceLars Wirzenius1-0/+6
Source files are: * the markdown file * the bindings, functions, and bibliography files listed in YAML metadata * any included images in the markdown The template file is not considered: it's only relevant for codegen. The docgen binary is not considered, either, for now, because reliably finding the binary is difficult.
2020-05-02Fix: check that stdout matches expected patternLars Wirzenius1-7/+8
The stdout_matches function in subplot.py was lacking an assert. This meant all steps checking that stdout contained a desired string passed, even when they shouldn't have. I did the original changes sloppily: I should've verified the test fails with a wrong pattern before finishing the stdout_matches function. Also, fix scenarios that were passing because of this, but shouldn't have been. Further, fixing this revealed another problem: the way subplot.md was checking that the simple and regex patterns were working was broken: they were using a step that looked for specific output to make sure a nested subplot was calling its function, but doing that in a way that assumed specific output. This wasn't just broken, but also very confusing to debug. This commit changes things so the generic stdout matching step is used instead and is clearer to me.
2020-04-19Add: acceptance criteria for simple patternsLars Wirzenius1-0/+3
This adds scenarios for regex patterns capture and simple pattern capture from scenario steps, and additionally makes use of simple patterns everywhere possible in the examples.
2020-04-11Change: docgen to not change output needlesslyLars Wirzenius1-0/+26
If the output file wouldn't change, then don't update it. This is imperfect, since it still needs to produce the output file, so it can spend a bit of processing power to make no changes. But the alternative would be to make needless changes.
2020-04-10Change: check for embedded files with non-unique namesLars Wirzenius1-0/+3
This is ugly and panics, but that's acceptable for now. We'll clean this up later.
2020-02-26Add: scenarios for testing document dateLars Wirzenius1-0/+18
2020-02-15Change: require docgen, codegen to fail if document has no titleLars Wirzenius1-2/+11
sp-filter already has a test that requires it to work without a title.
2020-01-11Add: scenario for testing sp-metaLars Wirzenius1-0/+8
2020-01-11Change: sp-filter scenario to check it works without YAML metadataLars Wirzenius1-0/+3
2020-01-11Add: scenarios for testing sp-filter, dot and roadmap graphsLars Wirzenius1-0/+12
2020-01-10Add: --templates option to sp-codegenLars Wirzenius1-1/+2
2020-01-06Change: implement other functionsLars Wirzenius1-9/+21
2020-01-06Add: progress reporting in generated test programLars Wirzenius1-0/+30
2020-01-05Add: Subplot document for Subplot itselfLars Wirzenius1-0/+0