Skip to content

Commit

Permalink
Fixed testing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandloria committed Apr 15, 2022
1 parent 537a6f1 commit ae54bbe
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 59 deletions.
9 changes: 4 additions & 5 deletions gcc_exec/gcc_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@

import xmltodict
from botocore.exceptions import ClientError

from gcc_exec.gcc_drbx import GccDrbx
from gcc_exec.gcc_ec2 import GccEc2
from gcc_exec.gcc_node import GccNode
from gcc_exec.gcc_user import GccUser
from gcc_drbx import GccDrbx
from gcc_ec2 import GccEc2
from gcc_node import GccNode
from gcc_user import GccUser


class GccWorkflow:
Expand Down
5 changes: 2 additions & 3 deletions gcc_exec/tests/test_gcc_drbx.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
"""This file contains the TestGccDrbx class."""

# pylint: disable=E0401
import os
from os.path import dirname, join

from dotenv import load_dotenv
from dropbox.files import CreateFolderResult, DeleteResult, FileMetadata, FolderMetadata

from gcc_exec.gcc_drbx import GccDrbx
from gcc_drbx import GccDrbx


class TestGccDrbx:
Expand Down
3 changes: 1 addition & 2 deletions gcc_exec/tests/test_gcc_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import pytest
from botocore.exceptions import ClientError
from dotenv import load_dotenv

from gcc_exec.gcc_ec2 import GccEc2
from gcc_ec2 import GccEc2


class TestGccEc2:
Expand Down
29 changes: 13 additions & 16 deletions gcc_exec/tests/test_gcc_workflow.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
"""This file contains the TestGccWorkflow class."""
# pylint: disable=W1514,R0913
# pylint: disable=W1514,R0913,E0401
import os
from os.path import dirname, join
from unittest import mock

import pytest
from dotenv import load_dotenv

from gcc_exec.gcc_user import GccUser
from gcc_exec.gcc_workflow import GccWorkflow
from gcc_user import GccUser
from gcc_workflow import GccWorkflow


class TestGccWorkflow:
Expand Down Expand Up @@ -105,19 +104,19 @@ def test_plan(
)

@mock.patch(
"gcc_exec.gcc_node.GccNode.initialize",
"gcc_node.GccNode.initialize",
return_value=None,
)
@mock.patch(
"gcc_exec.gcc_ec2.GccEc2.create_key_pair",
"gcc_ec2.GccEc2.create_key_pair",
return_value=None,
)
@mock.patch(
"gcc_exec.gcc_ec2.GccEc2.create_security_group",
"gcc_ec2.GccEc2.create_security_group",
return_value=None,
)
@mock.patch(
"gcc_exec.gcc_drbx.GccDrbx.create_folder",
"gcc_drbx.GccDrbx.create_folder",
return_value=None,
)
@mock.patch("os.makedirs", return_value=None)
Expand Down Expand Up @@ -178,12 +177,10 @@ def test_initialize(
assert mock_makedirs.called

@mock.patch(
"gcc_exec.gcc_node.GccNode.set_config_commands",
"gcc_node.GccNode.set_config_commands",
return_value=None,
)
@mock.patch(
"gcc_exec.gcc_node.GccNode.configure_virtual_machine", return_value=None
)
@mock.patch("gcc_node.GccNode.configure_virtual_machine", return_value=None)
@pytest.mark.parametrize(
"xml_specification_filename,workflow_name",
[
Expand Down Expand Up @@ -224,7 +221,7 @@ def test_configure(
assert mock_configure_virtual_machine.called

@mock.patch(
"gcc_exec.gcc_node.GccNode.execute",
"gcc_node.GccNode.execute",
return_value=None,
)
@mock.patch("time.sleep", return_value=None)
Expand Down Expand Up @@ -280,15 +277,15 @@ def test_execute(
assert mock_execute.called

@mock.patch(
"gcc_exec.gcc_node.GccNode.terminate",
"gcc_node.GccNode.terminate",
return_value=None,
)
@mock.patch(
"gcc_exec.gcc_ec2.GccEc2.delete_key_pair",
"gcc_ec2.GccEc2.delete_key_pair",
return_value=None,
)
@mock.patch(
"gcc_exec.gcc_ec2.GccEc2.delete_security_group",
"gcc_ec2.GccEc2.delete_security_group",
return_value=None,
)
@mock.patch("shutil.rmtree", return_value=None)
Expand Down
51 changes: 20 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ psutil = "^5.9.0"
paramiko = "^2.10.3"
requests = "^2.27.1"
rpyc = "^5.1.0"
unittest = "^0.0"

[tool.poetry.dev-dependencies]
black = "^22.3.0"
Expand All @@ -30,9 +29,14 @@ taskipy = "^1.10.1"
pytest-codecov = "^0.4.0"
coverage = "^6.3.2"

[tool.pytest.ini_options]
pythonpath = [
".", "gcc_exec",
]

[tool.taskipy.tasks]
lint = { cmd = "black gcc_exec socket_service --check;flake8 gcc_exec socket_service --ignore=E501,W503;pylint gcc_exec socket_service", help = "Run the black checks for source code format" }
test = { cmd = "pytest --cov gcc_exec/tests --cov-report xml:coverage.xml", help = "Run the test suite to ensure code correctness" }
test = { cmd = "pytest --cov gcc_exec --cov-report xml:coverage.xml", help = "Run the test suite to ensure code correctness" }

[build-system]
requires = ["poetry-core>=1.0.0"]
Expand Down

0 comments on commit ae54bbe

Please sign in to comment.