Skip to content

Commit

Permalink
Merge pull request #36 from eduNEXT/JDB/environment-manager-migration
Browse files Browse the repository at this point in the history
feat: Migrate project init command to a clean architecture
  • Loading branch information
JuanDavidBuitrago committed Jul 29, 2022
2 parents 664b53b + a7d688c commit 9ed2153
Show file tree
Hide file tree
Showing 38 changed files with 600 additions and 233 deletions.
1 change: 1 addition & 0 deletions requirements/base.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ requests
jinja2
pyyaml
GitPython
requests-cache
50 changes: 36 additions & 14 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,52 @@
#
# This file is autogenerated by pip-compile with python 3.8
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# make upgrade
#
certifi==2021.5.30
appdirs==1.4.4
# via requests-cache
attrs==21.4.0
# via
# cattrs
# requests-cache
cattrs==22.1.0
# via requests-cache
certifi==2022.6.15
# via requests
charset-normalizer==2.0.4
charset-normalizer==2.1.0
# via requests
click==8.0.1
click==8.1.3
# via -r requirements/base.in
gitdb==4.0.7
exceptiongroup==1.0.0rc8
# via
# cattrs
# requests-cache
gitdb==4.0.9
# via gitpython
gitpython==3.1.18
gitpython==3.1.27
# via -r requirements/base.in
idna==3.2
idna==3.3
# via requests
jinja2==3.0.1
jinja2==3.1.2
# via -r requirements/base.in
markupsafe==2.0.1
markupsafe==2.1.1
# via jinja2
pyyaml==5.4.1
pyyaml==6.0
# via -r requirements/base.in
requests==2.26.0
requests==2.28.1
# via
# -r requirements/base.in
# requests-cache
requests-cache==0.9.5
# via -r requirements/base.in
smmap==4.0.0
six==1.16.0
# via url-normalize
smmap==5.0.0
# via gitdb
urllib3==1.26.6
# via requests
url-normalize==1.4.3
# via requests-cache
urllib3==1.26.11
# via
# requests
# requests-cache
2 changes: 2 additions & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ pydocstyle
coverage
pytest
pudb
requests
requests-cache
115 changes: 79 additions & 36 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -1,96 +1,139 @@
#
# This file is autogenerated by pip-compile with python 3.8
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# make upgrade
#
astroid==2.7.3
appdirs==1.4.4
# via
# -r requirements/base.txt
# requests-cache
astroid==2.11.7
# via pylint
attrs==21.2.0
# via pytest
certifi==2021.5.30
attrs==21.4.0
# via
# -r requirements/base.txt
# cattrs
# pytest
# requests-cache
cattrs==22.1.0
# via
# -r requirements/base.txt
# requests-cache
certifi==2022.6.15
# via
# -r requirements/base.txt
# requests
charset-normalizer==2.0.4
charset-normalizer==2.1.0
# via
# -r requirements/base.txt
# requests
click==8.0.1
click==8.1.3
# via -r requirements/base.txt
coverage==5.5
coverage==6.4.2
# via -r requirements/dev.in
gitdb==4.0.7
dill==0.3.5.1
# via pylint
exceptiongroup==1.0.0rc8
# via
# -r requirements/base.txt
# cattrs
# requests-cache
gitdb==4.0.9
# via
# -r requirements/base.txt
# gitpython
gitpython==3.1.18
gitpython==3.1.27
# via -r requirements/base.txt
idna==3.2
idna==3.3
# via
# -r requirements/base.txt
# requests
iniconfig==1.1.1
# via pytest
isort==5.9.3
isort==5.10.1
# via pylint
jedi==0.18.0
jedi==0.18.1
# via pudb
jinja2==3.0.1
jinja2==3.1.2
# via -r requirements/base.txt
lazy-object-proxy==1.6.0
lazy-object-proxy==1.7.1
# via astroid
markupsafe==2.0.1
markupsafe==2.1.1
# via
# -r requirements/base.txt
# jinja2
mccabe==0.6.1
mccabe==0.7.0
# via pylint
packaging==21.0
# via pytest
parso==0.8.2
packaging==21.3
# via
# pudb
# pytest
parso==0.8.3
# via jedi
platformdirs==2.3.0
platformdirs==2.5.2
# via pylint
pluggy==1.0.0
# via pytest
pudb==2021.1
pudb==2022.1.2
# via -r requirements/dev.in
py==1.10.0
py==1.11.0
# via pytest
pycodestyle==2.7.0
pycodestyle==2.8.0
# via -r requirements/dev.in
pydocstyle==6.1.1
# via -r requirements/dev.in
pygments==2.10.0
pygments==2.12.0
# via pudb
pylint==2.10.2
pylint==2.14.5
# via -r requirements/dev.in
pyparsing==2.4.7
pyparsing==3.0.9
# via packaging
pytest==6.2.5
pytest==7.1.2
# via -r requirements/dev.in
pyyaml==5.4.1
# via -r requirements/base.txt
requests==2.26.0
pyyaml==6.0
# via -r requirements/base.txt
smmap==4.0.0
requests==2.28.1
# via
# -r requirements/base.txt
# -r requirements/dev.in
# requests-cache
requests-cache==0.9.5
# via
# -r requirements/base.txt
# -r requirements/dev.in
six==1.16.0
# via
# -r requirements/base.txt
# url-normalize
smmap==5.0.0
# via
# -r requirements/base.txt
# gitdb
snowballstemmer==2.1.0
snowballstemmer==2.2.0
# via pydocstyle
toml==0.10.2
tomli==2.0.1
# via
# pylint
# pytest
urllib3==1.26.6
tomlkit==0.11.1
# via pylint
url-normalize==1.4.3
# via
# -r requirements/base.txt
# requests-cache
urllib3==1.26.11
# via
# -r requirements/base.txt
# requests
# requests-cache
urwid==2.1.2
# via
# pudb
# urwid-readline
urwid-readline==0.13
# via pudb
wrapt==1.12.1
wrapt==1.14.1
# via astroid

# The following packages are considered to be unsafe in a requirements file:
Expand Down
22 changes: 15 additions & 7 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
#
# This file is autogenerated by pip-compile with python 3.8
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# make upgrade
#
click==8.0.1
build==0.8.0
# via pip-tools
pep517==0.11.0
click==8.1.3
# via pip-tools
pip-tools==6.2.0
packaging==21.3
# via build
pep517==0.12.0
# via build
pip-tools==6.8.0
# via -r requirements/pip-tools.in
tomli==1.2.1
# via pep517
wheel==0.37.0
pyparsing==3.0.9
# via packaging
tomli==2.0.1
# via
# build
# pep517
wheel==0.37.1
# via pip-tools

# The following packages are considered to be unsafe in a requirements file:
Expand Down
8 changes: 4 additions & 4 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#
# This file is autogenerated by pip-compile with python 3.8
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# make upgrade
#
wheel==0.37.0
wheel==0.37.1
# via -r requirements/pip.in

# The following packages are considered to be unsafe in a requirements file:
pip==21.2.4
pip==22.2.1
# via -r requirements/pip.in
setuptools==57.4.0
setuptools==63.2.0
# via -r requirements/pip.in
Empty file.
Empty file.
32 changes: 32 additions & 0 deletions tests/environment_manager/application/test_plugin_installer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import pytest

from tests.environment_manager.infrastructure.environment_manager_in_memory_repository import (
EnvironmentManagerInMemoryRepository,
)
from tvm.environment_manager.application.plugin_installer import PluginInstaller


def test_should_install_the_tutor_plugin():
# Given
options = ["tutor-mfe"]
repository = EnvironmentManagerInMemoryRepository()

# When
installer = PluginInstaller(repository=repository)
installer(options)

# Then
assert options in repository.PLUGINS_INSTALLED


def test_should_fail_if_not_add_tutor_plugin():
# Given
options = []
repository = EnvironmentManagerInMemoryRepository()

# When
installer = PluginInstaller(repository=repository)

# Then
with pytest.raises(Exception) as format_err:
installer(options)
34 changes: 34 additions & 0 deletions tests/environment_manager/application/test_plugin_uninstaller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import pytest

from tests.environment_manager.infrastructure.environment_manager_in_memory_repository import (
EnvironmentManagerInMemoryRepository,
)
from tvm.environment_manager.application.plugin_uninstaller import (
PluginUninstaller,
)


def test_should_uninstall_the_tutor_plugin():
# Given
options = "codejail"
repository = EnvironmentManagerInMemoryRepository()

# When
uninstaller = PluginUninstaller(repository=repository)
uninstaller(options)

# Then
assert options not in repository.PLUGINS_INSTALLED


def test_should_fail_if_not_add_tutor_plugin():
# Given
options = "tutor-mfe"
repository = EnvironmentManagerInMemoryRepository()

# When
uninstaller = PluginUninstaller(repository=repository)

# Then
with pytest.raises(Exception) as format_err:
uninstaller(options)
Loading

0 comments on commit 9ed2153

Please sign in to comment.