Skip to content
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

Closed
wants to merge 21 commits into from
Closed

Windows testing support for Rasa #5784

wants to merge 21 commits into from

Conversation

alwx
Copy link
Contributor

@alwx alwx commented May 6, 2020

Proposed changes:

  • ...

Status (please check what you already did):

  • added some tests for the functionality
  • updated the documentation
  • updated the changelog (please check changelog for instructions)
  • reformat files using black (please check Readme for instructions)

@alwx alwx changed the title Windows testing Windows support for Rasa May 8, 2020
@alwx alwx changed the title Windows support for Rasa Windows testing support for Rasa May 11, 2020
@alwx alwx requested review from wochinge and ricwo May 11, 2020 15:15
Copy link
Contributor

@ricwo ricwo left a 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(
Copy link
Contributor

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?

Copy link
Contributor Author

@alwx alwx May 15, 2020

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)

Copy link
Member

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?

Copy link
Contributor Author

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.

Comment on lines +1275 to +1281
def __init__(
self,
timestamp: Optional[float] = None,
metadata: Optional[Dict[Text, Any]] = None,
) -> None:
super().__init__(timestamp, metadata)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why this change?

tests/cli/test_rasa_init.py Show resolved Hide resolved
@@ -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]
Copy link
Contributor

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

Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

tests/utilities.py Outdated Show resolved Hide resolved
Comment on lines +35 to +38
assert (
utils.relative_normpath(test_file, "/my/test").replace("\\", "/")
== "path/file.txt"
)
Copy link
Contributor

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()

Suggested change
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():
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
assert platform_independent_paths(paths[1]) == expected
assert Path(paths[1]) == Path(expected)

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
Copy link
Contributor

@wochinge wochinge left a 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!

changelog/5784.misc.rst Outdated Show resolved Hide resolved
@@ -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
Copy link
Contributor

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?

tests/core/test_tracker_stores.py Outdated Show resolved Hide resolved
BotUttered("Hi"),
SessionStarted(),
UserUttered("Ciao", {"name": "greet"}),
UserUttered("Hola", {"name": "greet"}, timestamp=1),
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor

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

@alwx alwx closed this Jul 22, 2020
@m-vdb m-vdb deleted the windows-testing branch September 22, 2020 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants