Moved generate_json_map to new module#226
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #226 +/- ##
==========================================
- Coverage 95.28% 95.27% -0.01%
==========================================
Files 10 11 +1
Lines 890 932 +42
==========================================
+ Hits 848 888 +40
- Misses 42 44 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
1343d80 to
1ccf832
Compare
1ccf832 to
cebc3e8
Compare
| # Set top level display name from root element | ||
| current_node.display_name = self._parse_display_name( | ||
| root.name.text, screen_path | ||
| ) | ||
| current_node.display_name = self._get_component_label( | ||
| name_elem, | ||
| current_component_name, | ||
| current_node.display_name, | ||
| ) |
There was a problem hiding this comment.
Could this be replaced with the _get_display_name() function?
| if self.techui == Path("techui.yaml"): | ||
| self.techui = self._write_directory.joinpath("techui.yaml") |
There was a problem hiding this comment.
This will just compare to the default value of the field instead of hard-coding it, and will also only overwrite it if the path doesn't exist
| if self.techui == Path("techui.yaml"): | |
| self.techui = self._write_directory.joinpath("techui.yaml") | |
| # Check if techui is default value and that it doesn't exist | |
| if ( | |
| self.techui == self.__class__.__dataclass_fields__["techui"].default | |
| and not self.techui.exists() | |
| ): | |
| self.techui = self._write_directory.joinpath("techui.yaml") |
| assert test_json_map == example_json_map | ||
|
|
||
|
|
||
| def test_generate_json_map_embedded_screen( |
There was a problem hiding this comment.
You will need to patch things like _parse_display_name() in these tests
| json_map_generator.write_json_map() | ||
|
|
||
|
|
||
| def test_app(): |
There was a problem hiding this comment.
As this is effectively the CLI test, it should only be in test_cli.py
| @app.callback(invoke_without_command=True) | ||
| def generate_jsonmap( |
There was a problem hiding this comment.
This should probably be changed to run with a command, such as techui-builder generate-jsonmap as part of the main Typer app created in __main__.py, instead of creating a second Typer app. You also then won't need to declare it in the main() function as a Typer Option.
You will need to see how to access the same typer.Typer app that was defined in __main__.py though from generate_jsonmap.py...
| @app.callback(invoke_without_command=True) | |
| def generate_jsonmap( | |
| @app.command("generate-jsonmap") | |
| def generate_jsonmap( |
Moved generate_json_map to new module called generate_jsonmap.