예제 #1
0
 def setUp(self):
     utils.add_data_frame_equality_func(self)
     self.log_entries = [
         scm.LogEntry(
             revision="abc",
             author="Agatha",
             date=dt.datetime(2019, 1, 13),
             path="dir/file.txt",
             message="",
             kind="file",
             textmods=True,
             propmods=False,
             action="M",
         ),
         scm.LogEntry(
             revision="abd",
             author="Agatha",
             date=dt.datetime(2019, 2, 1),
             path="dir/file.txt",
             message="",
             kind="file",
             textmods=True,
             propmods=False,
             action="M",
         ),
     ]
예제 #2
0
 def setUp(self):
     utils.add_data_frame_equality_func(self)
     self.after = dt.datetime(2018, 2, 24, tzinfo=dt.timezone.utc)
     self.get_check_patcher = mock.patch(
         'codemetrics.internals.check_run_in_root',
         autospec=True)
     self.check_run_in_root = self.get_check_patcher.start()
     self.svn = cm.svn._SvnLogCollector(relative_url='/project/trunk')
예제 #3
0
 def setUp(self):
     """Mocks the internal run command."""
     add_data_frame_equality_func(self)
     self.run_output = textwrap.dedent("""\
     language,filename,blank,comment,code,"http://cloc.sourceforge.net"
     Python,internals.py,55,50,130
     Python,tests.py,29,92,109
     Python,setup.py,4,2,30
     """)
     cmi = 'codemetrics.internals.'
     self.run_patcher = mock.patch(cmi + 'run',
                                   autospec=True,
                                   return_value=self.run_output)
     self.check_patcher = mock.patch(cmi + 'check_run_in_root',
                                     autospec=True)
     self.run_ = self.run_patcher.start()
     self.check_run_from_root = self.check_patcher.start()
예제 #4
0
    def setUp(self):
        """Prepare environment for the tests.

        - Adds hanlding of equality test for pandas.DataFrame.
        - Patches the function get_now for a specific date.

        """
        utils.add_data_frame_equality_func(self)
        self.now = dt.datetime(2018, 12, 6, 21, 0, tzinfo=dt.timezone.utc)
        self.get_now_patcher = mock.patch('codemetrics.internals.get_now',
                                          autospec=True,
                                          return_value=self.now)
        self.get_now = self.get_now_patcher.start()
        self.get_check_patcher = mock.patch(
            'codemetrics.internals.check_run_in_root', autospec=True)
        self.check_run_in_root = self.get_check_patcher.start()
        self.after = dt.datetime(2018, 12, 3, tzinfo=dt.timezone.utc)
예제 #5
0
    def setUp(self, project: scm.Project) -> None:
        """Set up common to all log getting test cases.

        Adds hanlding of equality test for pandas.DataFrame and patches the
        functions get_now for a specific date and check_run_in_root.

        Args:
            get_log_func: function that will retrieve the log from SCM tool.

        """
        utils.add_data_frame_equality_func(self)
        # get_log_func could be git.get_git_log or svn.get_svn_log. See subclasses setUp().
        self.project = project
        self.now = dt.datetime(2018, 12, 6, 21, 0, tzinfo=dt.timezone.utc)
        self.get_now_patcher = mock.patch("codemetrics.internals.get_now",
                                          autospec=True,
                                          return_value=self.now)
        self.get_now = self.get_now_patcher.start()
        self.get_check_patcher = mock.patch(
            "codemetrics.internals.check_run_in_root", autospec=True)
        self.check_run_in_root = self.get_check_patcher.start()
        self.after = dt.datetime(2018, 12, 3, tzinfo=dt.timezone.utc)
예제 #6
0
 def setUp(self):
     utils.add_data_frame_equality_func(self)
     self.log_entries = [
         scm.LogEntry(revision='abc',
                      author='Agatha',
                      date=dt.datetime(2019, 1, 13),
                      path='dir/file.txt',
                      message='',
                      kind='file',
                      textmods=True,
                      propmods=False,
                      action='M'),
         scm.LogEntry(revision='abd',
                      author='Agatha',
                      date=dt.datetime(2019, 2, 1),
                      path='dir/file.txt',
                      message='',
                      kind='file',
                      textmods=True,
                      propmods=False,
                      action='M'),
     ]