Exemplo n.º 1
0
 def test_get_log_no_msg(self, _):
     """Simple svn call returns pandas.DataFrame."""
     df = self.svn.get_log(after=self.after)
     expected = utils.csvlog_to_dataframe(textwrap.dedent('''
     revision,author,date,path,message,kind,action,textmods,propmods
     1018,elmotec,2018-02-24T11:14:11.000000Z,stats.py,,file,M,true,false'''))
     self.assertEqual(expected, df)
Exemplo n.º 2
0
 def test_get_log_no_author(self, call):
     """Simple svn call returns pandas.DataFrame."""
     expected = utils.csvlog_to_dataframe(textwrap.dedent('''
     revision,author,date,path,message,kind,action,textmods,propmods
     1018,,2018-02-24T11:14:11.000000Z,stats.py,i am invisible!,file,M,true,false'''))
     actual = self.svn.get_log(after=self.after)
     call.assert_called_with('svn log --xml -v -r {2018-02-24}:HEAD .')
     self.assertEqual(expected, actual)
Exemplo n.º 3
0
 def test_dataframe_conversion(self):
     """Check conversion to DataFrame."""
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent("""\
     revision,author,date,path,message,kind,action
     abc,Agatha,2019-01-13T00:00:00.000000Z,dir/file.txt,,file,M
     abd,Agatha,2019-02-01T00:00:00.000000Z,dir/file.txt,,file,M"""))
     self.assertEqual(expected, self.actual)
Exemplo n.º 4
0
 def test_date_to_utc(self):
     """TBD"""
     csv_data = textwrap.dedent("""
     ,revision,author,date,path,message,kind,action
     0,dfa9d6f08,Joris,2020-11-28 15:27:20+01:00,pandas/tests/series/methods/test_convert_dtypes.py,TST: rewrite
     1,91abd0aba,Joris,2020-11-27 21:12:01+01:00,doc/source/whatsnew/v1.1.5.rst,REGR: fix"""
                                )
     actual = utils.csvlog_to_dataframe(csv_data)
     self.assertEqual("datetime64[ns, UTC]", actual["date"].dtype.name)
Exemplo n.º 5
0
 def test_get_log(self, run_):
     """Simple svn run_ returns pandas.DataFrame."""
     actual = self.svn.get_log(after=self.after)
     run_.assert_called_with('svn log --xml -v -r {2018-02-24}:HEAD .')
     expected = utils.csvlog_to_dataframe(textwrap.dedent('''
     revision,author,date,path,message,kind,action,textmods,propmods
     1018,elmotec,2018-02-24T11:14:11.000000Z,stats.py,Very descriptive,file,M,true,false
     1018,elmotec,2018-02-24T11:14:11.000000Z,requirements.txt,Very descriptive,file,M,true,false'''))
     self.assertEqual(expected, actual)
Exemplo n.º 6
0
 def test_get_log_renamed_file(self, call):
     """Simple svn call returns pandas.DataFrame."""
     expected = utils.csvlog_to_dataframe(textwrap.dedent('''
     revision,author,date,path,message,kind,action,textmods,propmods,copyfromrev,copyfrompath
     1018,,2018-02-24T11:14:11.000000Z,stats.py,renamed,file,D,false,false,,
     1018,,2018-02-24T11:14:11.000000Z,new_stats.py,renamed,file,A,false,false,930,stats.py
     '''))
     df = self.svn.get_log(after=self.after)
     call.assert_called_with('svn log --xml -v -r {2018-02-24}:HEAD .')
     self.assertEqual(expected, df)
Exemplo n.º 7
0
 def get_log_df():
     csv_data = textwrap.dedent(
         """
     revision,author,date,textmods,kind,action,propmods,path,message,added,removed
     1016,elmotec,2018-02-26T10:28:00Z,true,file,M,false,stats.py,modified again,1,2
     1018,elmotec,2018-02-24T11:14:11Z,true,file,M,false,stats.py,modified,3,4
     1018,elmotec,2018-02-24T11:14:11Z,true,file,M,false,requirements.txt,modified,5,6"""
     )
     df = utils.csvlog_to_dataframe(csv_data)
     return df
Exemplo n.º 8
0
 def test_handling_of_brackets_in_log(self, _):
     """Handles brackets inside the commit log."""
     df = self.project.get_log(after=self.after)
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent(
             """\
     revision,author,date,path,message,kind,action,copyfromrev,copyfrompath,added,removed
     xxxxxxx,elmotec,2018-12-05 23:44:38+00:00,some/file,bbb [internals skip] [skipci],f,,,,1,1"""
         )
     )
     self.assertEqual(expected, df)
Exemplo n.º 9
0
 def test_handling_of_binary_files(self, _):
     """Handles binary files which do not show added or removed lines."""
     df = self.project.get_log(after=self.after)
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent(
             """\
     revision,author,date,path,message,kind,action
     xxxxxxx,elmotec,2018-12-05 23:44:38+00:00,directory/output.xls,excel file,f,"""
         )
     )
     self.assertEqual(expected, df)
Exemplo n.º 10
0
 def test_handling_of_binary_files(self, call):
     """Handles binary files which do not show added or removed lines."""
     df = git.get_git_log('.', after=self.after)
     call.assert_called_with(
         f'git {git._GitLogCollector._args} --after 2018-12-03 .')
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent('''\
     revision,author,date,path,message,kind,action
     xxxxxxx,elmotec,2018-12-05 23:44:38+00:00,directory/output.xls,excel file,f,'''
                         ))
     self.assertEqual(expected, df)
Exemplo n.º 11
0
 def test_get_log_no_author(self, call):
     """Simple svn call returns pandas.DataFrame."""
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent("""
     revision,author,date,path,message,kind,action,textmods,propmods
     1018,,2018-02-24T11:14:11.000000Z,stats.py,i am invisible!,file,M,true,false"""
                         ))
     actual = self.project.get_log(after=self.after,
                                   relative_url="/project/trunk")
     call.assert_called_with(
         "svn log --xml -v -r {2018-12-03}:HEAD .".split(), cwd="<root>")
     self.assertEqual(expected, actual)
Exemplo n.º 12
0
 def test_handling_of_brackets_in_log(self, call):
     """Handles brackets inside the commit log."""
     df = git.get_git_log('.', after=self.after)
     call.assert_called_with(
         f'git {git._GitLogCollector._args} --after {self.after:%Y-%m-%d} .'
     )
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent('''\
     revision,author,date,path,message,kind,action,copyfromrev,copyfrompath,added,removed
     xxxxxxx,elmotec,2018-12-05 23:44:38+00:00,some/file,bbb [ci skip] [skipci],f,,,,1,1'''
                         ))
     self.assertEqual(expected, df)
Exemplo n.º 13
0
 def test_get_log_renamed_file(self, call):
     """Simple svn call returns pandas.DataFrame."""
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent("""
     revision,author,date,path,message,kind,action,textmods,propmods,copyfromrev,copyfrompath
     1018,,2018-02-24T11:14:11.000000Z,stats.py,renamed,file,D,false,false,,
     1018,,2018-02-24T11:14:11.000000Z,new_stats.py,renamed,file,A,false,false,930,stats.py
     """))
     actual = self.project.get_log(after=self.after,
                                   relative_url="/project/trunk")
     call.assert_called_with(
         "svn log --xml -v -r {2018-12-03}:HEAD .".split(), cwd="<root>")
     self.assertEqual(expected.T, actual.T)
Exemplo n.º 14
0
 def test_empty_diff(self, _):
     """Handles log segment with no diffs."""
     actual = self.project.get_log(path=".", after=self.after)
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent(
             """\
     revision,author,date,path,message,kind,added,removed
     a897aad,elmotec,2019-01-25 12:05:25,,Merge nothing,X,0,0
     1987486,elmotec,2019-01-25 12:04:31,.gitignore,Change,f,3,4
     """
         )
     )
     self.assertEqual(expected, actual)
Exemplo n.º 15
0
 def test_get_log(self, run_):
     """Simple svn run_ returns pandas.DataFrame."""
     actual = cm.get_log(self.project,
                         after=self.after,
                         relative_url="/project/trunk")
     run_.assert_called_with(
         "svn log --xml -v -r {2018-12-03}:HEAD .".split(), cwd="<root>")
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent("""
     revision,author,date,path,message,kind,action,textmods,propmods
     1018,elmotec,2018-02-24T11:14:11.000000Z,stats.py,Very descriptive,file,M,true,false
     1018,elmotec,2018-02-24T11:14:11.000000Z,requirements.txt,Very descriptive,file,M,true,false"""
                         ))
     self.assertEqual(expected, actual)
Exemplo n.º 16
0
    def test_get_log(self, _):
        """Simple git call returns pandas.DataFrame."""
        actual = self.project.get_log(after=self.after)
        expected = utils.csvlog_to_dataframe(
            textwrap.dedent(
                """

revision,author,date,path,message,kind,action,copyfromrev,copyfrompath,added,removed
2adcc03,elmotec,2018-12-05 23:44:38+00:00,codemetrics/core.py,Fixed Windows specific paths,f,,,,1,1
2adcc03,elmotec,2018-12-05 23:44:38+00:00,requirements.txt,Fixed Windows specific paths,f,,,,1,1
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,codemetrics/core.py,Added guess_components,f,,,,44,0
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,codemetrics/svn.py,Added guess_components,f,,,,1,8
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,requirements.txt,Added guess_components,f,,,,1,0
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,tests/test_core.py,Added guess_components,f,,,,110,18"""
            )
        )
        self.assertEqual(expected, actual)
Exemplo n.º 17
0
    def test_get_log(self, call):
        """Simple git call returns pandas.DataFrame."""
        actual = git.get_git_log('.', after=self.after)
        call.assert_called_with(
            f'git {git._GitLogCollector._args} --after {self.after:%Y-%m-%d} .'
        )
        expected = utils.csvlog_to_dataframe(
            textwrap.dedent('''
revision,author,date,path,message,kind,action,copyfromrev,copyfrompath,added,removed
2adcc03,elmotec,2018-12-05 23:44:38+00:00,codemetrics/core.py,Fixed Windows specific paths,f,,,,1,1
2adcc03,elmotec,2018-12-05 23:44:38+00:00,requirements.txt,Fixed Windows specific paths,f,,,,1,1
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,codemetrics/core.py,Added guess_components,f,,,,44,0
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,codemetrics/svn.py,Added guess_components,f,,,,1,8
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,requirements.txt,Added guess_components,f,,,,1,0
b9fe5a6,elmotec,2018-12-04 21:49:55+00:00,tests/test_core.py,Added guess_components,f,,,,110,18'''
                            ))
        self.assertEqual(expected, actual)
Exemplo n.º 18
0
 def test_handle_double_quotes_in_cmd_output(self):
     """Handles binary files which do not show added or removed lines."""
     cmd_output = [
         '"[dfa9d6f08] [Joris] [2020-11-28 15:27:20 +0100] [TST: rewrite]"',
         "145\t250\ttest_convert_dtypes.py",
         "",
     ]
     collector = cm.git._GitLogCollector()
     df = collector.process_log_output_to_df(
         cmd_output, after=dt.datetime(2020, 11, 1, tzinfo=dt.timezone.utc)
     )
     expected = utils.csvlog_to_dataframe(
         textwrap.dedent(
             """\
     revision,author,date,path,message,kind,added,removed
     dfa9d6f08,Joris,2020-11-28 15:27:20 +0100,test_convert_dtypes.py,TST: rewrite,f,145,250
     """
         )
     )
     self.assertEqual(expected.T, df.T)