def test_current_settings_problem(self):
        """Integration test to make sure that current settings for get_modules
        function returns modules for passed problems list.
        """
        problems = [1, 2]
        modules = solver.get_modules(problems=problems,
                                     **self.current_settings)

        correct_modules = [self.path_template.format(prb) for prb in problems]

        self.assertEqual(modules, correct_modules)
    def test_current_settings_problem_skip(self):
        """Make sure that get_modules does not add to modules variable
        problem numbers that are less than one or greater than upper bound
        in current_settings.
        """
        problems = [0, 1, solver_settings.UPPERBOUND + 1]
        modules = solver.get_modules(problems=problems,
                                     **self.current_settings)

        correct_modules = [self.path_template.format(1)]

        self.assertEqual(modules, correct_modules)
    def test_current_settings_glob(self):
        """Integration test to make sure that current settings for get_modules
        function returns every module that starts with problem_.
        """
        modules = solver.get_modules(problems=None, **self.current_settings)

        actual_modules = []

        files = glob.glob(self.current_settings['glob_pattern'])

        for path in files:
            directory, filename = os.path.split(path)
            base, ext = os.path.splitext(filename)
            actual_modules.append('.'.join([self.current_settings['package'],
                                            base]))

        actual_modules.sort()

        self.assertEqual(modules, actual_modules)