Completed
Pull Request — master (#39)
by Wojtek
09:11
created

TestGroupedOptimizer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
dl 0
loc 19
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A test___init__() 0 5 1
A setUp() 0 10 1
1
"""Module for testing grouped optimizer."""
2
3
from unittest import TestCase
4
from unittest.mock import Mock
5
6
from grortir.main.model.core.abstract_process import AbstractProcess
0 ignored issues
show
Configuration introduced by
The import grortir.main.model.core.abstract_process could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
7
from grortir.main.model.core.abstract_stage import AbstractStage
0 ignored issues
show
Configuration introduced by
The import grortir.main.model.core.abstract_stage could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
8
9
10
class TestGroupedOptimizer(TestCase):
11
    """Class for testing Optimizer."""
12
13
    def setUp(self):
14
        """Set up environment."""
15
        self.some_process = AbstractProcess()
16
        self.first_stage = AbstractStage()
17
        self.second_stage = AbstractStage()
18
        self.third_stage_a = Mock()
19
        self.third_stage_b = Mock()
20
        self.some_process.add_path([self.first_stage, self.second_stage,
21
                                    self.third_stage_a])
22
        self.some_process.add_edge(self.second_stage, self.third_stage_b)
23
24
    def test___init__(self):
25
        """Testing creating object."""
26
        optimizer = GroupedOptimizer(self.some_process)
0 ignored issues
show
Comprehensibility Best Practice introduced by
Undefined variable 'GroupedOptimizer'
Loading history...
27
        self.assertIsNotNone(optimizer)
28
        self.assertEqual(optimizer.process, self.some_process)
29