Repository navigation
Turn the library into a package #12
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
+162
−13
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,4 +31,6 @@ jobs: | |
|
|
||
| - run: uv run ruff check | ||
|
|
||
| - run: uv run mypy src | ||
| - run: uv run mypy src tests | ||
|
|
||
| - run: uv run pytest | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,22 @@ | ||
| A keyword library for Robot Framework intended to be used in combination with Robotmk. | ||
|
|
||
| ## Keywords | ||
|
|
||
| ```robotframework | ||
| *** Settings *** | ||
| Library RobotmkLibrary | ||
| ``` | ||
|
|
||
| | Keyword | Effect | | ||
| | --- | --- | | ||
| | `Monitor Subsequent Keyword Runtime discover_as=` | logs the marker that makes Checkmk discover the runtime of the next keyword, under its own name or the given one | | ||
|
|
||
| ### Development | ||
|
|
||
| ```sh | ||
| uv sync | ||
| uv run ruff format --diff | ||
| uv run ruff check | ||
| uv run mypy src | ||
| uv run pytest | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,9 @@ | ||
| import logging | ||
| """Keyword library for Robot Framework suites run by Robotmk. | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
| ``Library RobotmkLibrary`` imports the keywords, which live in | ||
| ``RobotmkLibrary.keyword_monitoring``. | ||
| """ | ||
|
|
||
| from RobotmkLibrary.keyword_monitoring import monitor_subsequent_keyword_runtime | ||
|
|
||
| def monitor_subsequent_keyword_runtime( | ||
| *, | ||
| discover_as: str | None = None, | ||
| ) -> None: | ||
| logger.info( | ||
| "The subsequent keyword will be discovered in Checkmk using its own name" | ||
| if discover_as is None | ||
| else f'The subsequent keyword will be discovered in Checkmk as: "{discover_as}"', | ||
| ) | ||
| __all__ = ["monitor_subsequent_keyword_runtime"] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| """Keywords for the runtime monitoring of the Checkmk test services.""" | ||
|
|
||
| import logging | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def monitor_subsequent_keyword_runtime( | ||
| *, | ||
| discover_as: str | None = None, | ||
| ) -> None: | ||
| """Log the marker that makes Checkmk discover the runtime of the next keyword.""" | ||
| logger.info( | ||
| "The subsequent keyword will be discovered in Checkmk using its own name" | ||
| if discover_as is None | ||
| else f'The subsequent keyword will be discovered in Checkmk as: "{discover_as}"', | ||
| ) | ||
|
|
||
|
|
||
| __all__ = ["monitor_subsequent_keyword_runtime"] |
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| """The library as Robot Framework itself loads it.""" | ||
|
|
||
| from robot.libdoc import LibraryDocumentation | ||
|
|
||
|
|
||
| def test_the_library_lists_the_runtime_keyword() -> None: | ||
| """Library RobotmkLibrary exposes exactly the keyword monitoring keyword. | ||
|
|
||
| libdoc loads the package as Robot Framework does. Outcome: the keyword list | ||
| is Monitor Subsequent Keyword Runtime only. | ||
| """ | ||
| assert [ | ||
| keyword.name for keyword in LibraryDocumentation("RobotmkLibrary").keywords | ||
| ] == ["Monitor Subsequent Keyword Runtime"] |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Right now, we only need this for testing, so we could add this as a dev dependency. I also checked the next PR, which implements the listener. Also there, we don't need it in production code. On the other hand, there is no point in using this package without this dependency and the fact that we use the V3 listener API certainly imposes some restriction. So I am fine with this, but again, please make sure Simon Meggle is as well.
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 clarify with him. Sadly this dependency is somewhat implicit but real but I am also not super happy with it.