-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
Custom importer Improvements #1281
Conversation
Hey @minchinweb, it looks like the test isn't running because it's being excluded by the |
@@ -31,7 +31,8 @@ Feature: Functionality of Importer and Exporter Plugins | |||
Given We use the config "basic_onefile.yaml" | |||
When We run "jrnl --version" | |||
Then the output should contain pyproject.toml version | |||
And The output should contain "<plugin_name> : <version> from jrnl.<source>.<type>.<filename>" | |||
And the output should contain "<plugin_name> : <version> from jrnl.<source>.<type>.<filename>" |
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.
It's good that we're fixing up the tests, so this is fine. For future test fixes/updates, though, can we focus on the /tests/bdd/features
directory instead?
features/plugins.feature
Outdated
@skip_only_with_external_plugins | ||
Scenario Outline: Custom JSON Import | ||
Given we use the config "empty_folder.yaml" | ||
When we run "jrnl --import ./features/data/simple_import.json" |
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.
No need to fix this here, but when we move this test to Pytest BDD, we should pipe this json in so it sits in the feature file (instead of having a separate file to manage).
except KeyboardInterrupt: | ||
print( | ||
"[Entries NOT imported into journal.]", | ||
file=sys.stderr, | ||
) | ||
sys.exit(0) | ||
data = json.loads(f) |
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.
👍
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.
I added some more inline comments.
4b72910
to
c535ae7
Compare
Except most of the other tests in the file are similarly tagged, and they do run.... As for #1193, it looks like that was merged to develop, so I'm not sure how best to move forward on that. Otherwise, I think all the review comments have been resolved. |
* behavior outline * FIrst pass at allow external plugins * remove template exporter * Add listing of active plugins to '--version' output * Documentation for plugins * [Docs] add custom imports and exporters to site TOC * [Docs] better linewrapping * enforce positive initial linewrap Check column widths update gitignore throw error when linewrap too small simply check for large enough linewrap value * delete unused error message * PR feedback make exception more informative update check_linewrap signature in src and test make check_linewrap a free function * delete unused function * delete else..pass block * newline for make format * Include dates_exporter * Use Base classes for importer and exporters. * [Docs] improve documentation of custom Importers and Exporters * [Testing] separate run with external plugin! * basic behavior test * prototype unittest for JSON Exporter test for unimplemented method * make format delete unused imports * Remove 'importer' or 'exporter' from filenames where not needed * [Test] run different tests with or without the external plugins installed * [Test] move test rot13 plugin into git tree from minchinweb/jrnl-rot13-exporter@0dc912a * consolidate demo plugins to common package * [Docs] name page for plugins * [Docs] include the sample plug in code files directly * style fixes * [test] determine whether to run external plug in tests based on installed packages * improved code documentation * style fixes for GitHub actions * Convert "short" and "pretty" (and "default") formaters to plugins further to jrnl-org#1177 * more code clean up tests pass locally...now for GitHub... * [tests] dynamically determine jrnl version for plugin tests * [GitHub Actions] direct install of testing plugins * Remove template code * [plugins] meta --> collector * [Docs] create scripted entries using an custom importer * (closer to) being able to run behave tests outside project root directory * We already know when exporter to use Don't re-calculate it! * [Tests] don't name test plugin 'testing" If so named, pip won't install it. * [Test] run behave tests with test plugins outside project root * [Test] behave tests pass locally * [Docs] fix typo * [GitHub Actions] run test commands from poetry's shell * black-ify code * [GitHub Actions] move downstream (rather than up) to run tests * [GitHub Actions] set shell to poetry * [GitHub Workflows] Manually activate virtual environment * [GitHub Actions] Skip Windows & Python 3.8 Can't seem to find Python exe? * [GiotHub Actions] explicitly use virtual env * [GitHub Actions] create virutal env directly * [GitHub Actions] better activate of Windows virtual env * [GitHub Actions] create virtual env on Mac * [Github Actions] install wheel and upgrade pip * [GitHub Actions] skip virtual environments altogether * [GitHub Actions] change directory for behave test * Remove Windows exclusions from CI as per note -- they should be working now Co-authored-by: Suhas <[email protected]> Co-authored-by: Micah Jerome Ellison <[email protected]>
Since we're implementing a plugin system that relies on implicit namespacing, we should remove these files so that they don't confuse and muddle our virtual envs (like the ones we use to run tests). Also, they're not longer needed as of Python 3.3. PEP 420 says: Allowing implicit namespace packages means that the requirement to provide an __init__.py file can be dropped completely...
Allows you to access jrnl by running `python -m jrnl`
* Move plugins tests back into normal test workflow * change when tests run * make tests slightly more readable in PR
Importers: handle writing the journal to disk ourselves (rather than delegating to the plugin) Plugins: First pass at testing custom importer
@minchinweb I updated the |
@wren So what's left? Just to move the tests to the new pytest framework? (P.S. thanks for dealing with the merge conflict!) |
…adding in appropriate parameters and no error step
Hey @minchinweb -- I just fixed the test, though it is failing now. There were a couple problems with it -- it was using the scenario outline, but had no examples, so behave iterated through the empty list and ran 0 tests from it. It also wasn't using the Also, could you modify the import test to take in new data? Currently, it imports data that's already in the journal defined by simple.yaml, so even if the import silently fails, it will still pass when it checks the contents at the end of the test:
|
@minchinweb Yup! We just need to move the tests. And to clarify what @micahellison is saying, the sample plugin doesn't quite work right now (you can test by installing it locally). So, fixing the test or modifying the test, it should hopefully go into pytest. |
P.S. Note the the Window scenarios in the CI aren't actually running tests... I get about a dozen failing tests locally (on Windows) and the trackbacks aren't making a lot of sense.... |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Closing due to staleness. Feel free to re-open with new contributions. |
Further to #1006