Remove Home folder for windows (#1502)

This commit is contained in:
Elijah Ahianyo 2023-08-03 21:27:38 +00:00 committed by GitHub
parent 123b91a37d
commit a9b7394e0e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 28 additions and 2 deletions

View File

@ -1,7 +1,7 @@
"""Import all classes and functions the end user will need to make an app. """Import all classes and functions the end user will need to make an app.
Anything imported here will be available in the default Reflex import as `rx.*`. Anything imported here will be available in the default Reflex import as `rx.*`.
To signal to typecheckers that something should be reexported, To signal to typecheckers that something should be reexported,
we use the Flask "import name as name" syntax. we use the Flask "import name as name" syntax.
""" """

View File

@ -438,7 +438,8 @@ def is_latest_template() -> bool:
def initialize_frontend_dependencies(): def initialize_frontend_dependencies():
"""Initialize all the frontend dependencies.""" """Initialize all the frontend dependencies."""
# Create the reflex directory. # Create the reflex directory.
path_ops.mkdir(constants.REFLEX_DIR) if not IS_WINDOWS:
path_ops.mkdir(constants.REFLEX_DIR)
# Install the frontend dependencies. # Install the frontend dependencies.
processes.run_concurrently(install_node, install_bun) processes.run_concurrently(install_node, install_bun)

View File

@ -558,3 +558,28 @@ def test_bun_install_without_unzip(mocker):
with pytest.raises(FileNotFoundError): with pytest.raises(FileNotFoundError):
prerequisites.install_bun() prerequisites.install_bun()
# from
@pytest.mark.parametrize("is_windows", [True, False])
def test_create_reflex_dir(mocker, is_windows):
"""Test that a reflex directory is created on initializing frontend
dependencies.
Args:
mocker: Pytest mocker object.
is_windows: Whether platform is windows.
"""
mocker.patch("reflex.utils.prerequisites.IS_WINDOWS", is_windows)
mocker.patch("reflex.utils.prerequisites.processes.run_concurrently", mocker.Mock())
mocker.patch("reflex.utils.prerequisites.initialize_web_directory", mocker.Mock())
create_cmd = mocker.patch(
"reflex.utils.prerequisites.path_ops.mkdir", mocker.Mock()
)
prerequisites.initialize_frontend_dependencies()
if is_windows:
assert not create_cmd.called
else:
assert create_cmd.called