-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Windows testing support for Rasa #5784
Conversation
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.
Looks really good 👍
if args.no_prompt: | ||
should_train = True | ||
else: | ||
should_train = questionary.confirm( |
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.
what happened to the skip_if()
s here?
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 simply doesn't work on Windows :( (it's an issue with questionary
)
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.
@alwx can we fix that in the questionary package? do you know what the underlying issue is?
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.
Had no chance to check it yet. Will try to find time for it tomorrow, maybe it's an easy fix.
def __init__( | ||
self, | ||
timestamp: Optional[float] = None, | ||
metadata: Optional[Dict[Text, Any]] = None, | ||
) -> None: | ||
super().__init__(timestamp, metadata) | ||
|
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.
why this change?
@@ -17,6 +31,10 @@ def json_of_latest_request(r): | |||
return r[-1].kwargs["json"] | |||
|
|||
|
|||
def platform_independent_paths(coll: List[Text]): | |||
return [i.replace("\\", "/") for i in coll] |
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 think we should be able to use pathlib.Path
everywhere which converts to PureWindowsPath
or PurePosixPath
automatically depending on the platform
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.
in that case we could get rid of this function
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.
👍
assert ( | ||
utils.relative_normpath(test_file, "/my/test").replace("\\", "/") | ||
== "path/file.txt" | ||
) |
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.
this should be platform-agnostic without the replace()
assert ( | |
utils.relative_normpath(test_file, "/my/test").replace("\\", "/") | |
== "path/file.txt" | |
) | |
assert ( | |
assert Path(utils.relative_normpath(test_file, "/my/test")) == Path("path/file.txt") | |
) |
@@ -32,7 +32,10 @@ def fake_model_dir(empty_model_dir): | |||
|
|||
def test_relative_normpath(): |
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.
we could also update the utils function to use Path(p).resolve()
- it replaces os.path.normpath()
as of py 3.6: https://docs.python.org/3.6/library/pathlib.html#pathlib.Path.resolve
core_files, nlu_files = data.get_core_nlu_files([data_dir]) | ||
assert nlu_files == expected | ||
paths = data.get_core_nlu_files([data_dir]) | ||
assert platform_independent_paths(paths[1]) == expected |
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.
assert platform_independent_paths(paths[1]) == expected | |
assert Path(paths[1]) == Path(expected) |
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.
Thanks a lot for this!
@@ -218,6 +218,7 @@ async def mocked_handle_message(self, message: UserMessage, wait: float) -> None | |||
assert time.time() - start_time < time_limit | |||
|
|||
|
|||
@pytest.mark.unix |
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.
what's the reason here?
BotUttered("Hi"), | ||
SessionStarted(), | ||
UserUttered("Ciao", {"name": "greet"}), | ||
UserUttered("Hola", {"name": "greet"}, timestamp=1), |
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.
do we need this because the timestamps on Windows would be the same?
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.
yes, all the timestamps on windows are the same, and the order is not consistent
@@ -207,6 +207,7 @@ def send_request() -> None: | |||
train_request.terminate() | |||
|
|||
|
|||
@pytest.mark.unix |
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.
why is this one required?
import rasa.utils.io as io_utils | ||
|
||
from yarl import URL |
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.
this is either the wrong import or it should be added to the dev dependencies
Co-authored-by: Ella Rohm-Ensing <erohmensing@gmail.com>
Co-authored-by: Ella Rohm-Ensing <erohmensing@gmail.com>
Co-authored-by: Ella Rohm-Ensing <erohmensing@gmail.com>
Proposed changes:
Status (please check what you already did):
black
(please check Readme for instructions)