示例#1
0
    def test_raw(self, harv_mock, log_mock):
        harv_mock.return_value = mock.sentinel.harvester

        cli.raw(['-'], summary=True, json=True)

        harv_mock.assert_called_once_with(['-'], cli.Config(exclude=None,
                                                            ignore=None,
                                                            summary=True))
        log_mock.assert_called_once_with(mock.sentinel.harvester, json=True)
示例#2
0
    def test_raw(self, harv_mock, log_mock):
        harv_mock.return_value = mock.sentinel.harvester

        cli.raw(['-'], summary=True, json=True)

        harv_mock.assert_called_once_with(['-'], cli.Config(exclude=None,
                                                            ignore=None,
                                                            summary=True))
        log_mock.assert_called_once_with(mock.sentinel.harvester, json=True)
示例#3
0
def test_raw(mocker, log_mock):
    harv_mock = mocker.patch('radon.cli.RawHarvester')
    harv_mock.return_value = mocker.sentinel.harvester

    cli.raw(['-'], summary=True, json=True)

    harv_mock.assert_called_once_with(['-'], cli.Config(exclude=None,
                                                        ignore=None,
                                                        summary=True))
    log_mock.assert_called_once_with(mocker.sentinel.harvester, json=True)
示例#4
0
def test_raw(mocker, log_mock):
    harv_mock = mocker.patch('radon.cli.RawHarvester')
    harv_mock.return_value = mocker.sentinel.harvester

    cli.raw(['-'], summary=True, json=True)

    harv_mock.assert_called_once_with(['-'],
                                      cli.Config(exclude=None,
                                                 ignore=None,
                                                 summary=True,
                                                 include_ipynb=False,
                                                 ipynb_cells=False))
    log_mock.assert_called_once_with(mocker.sentinel.harvester,
                                     stream=sys.stdout,
                                     json=True)
示例#5
0
def _run_raw_analysis():
    """Generates raw code metrics for the package"""
    modlog.debug("Starting raw analysis")
    pyjen_path = os.path.join(os.getcwd(), "pyjen")
    from radon.cli import raw

    standard_output = StringIO()
    with redirect_stdout(standard_output):
        modlog.debug("Calling radon.raw")
        raw(paths=[pyjen_path], summary=True)

    modlog.debug("Writing report to disk")
    raw_report = os.path.join(log_folder, "raw_stats.txt")
    with open(raw_report, "w") as fh:
        fh.write(standard_output.getvalue())
    standard_output.close()

    modlog.info("Raw code metrics generated successfully. See " + os.path.relpath(raw_report))
示例#6
0
文件: run.py 项目: tylerml/pyjen
def _run_raw_analysis():
    """Generates raw code metrics for the package"""
    modlog.debug("Starting raw analysis")
    pyjen_path = os.path.join(os.getcwd(), "pyjen")
    from radon.cli import raw

    standard_output = StringIO()
    with redirect_stdout(standard_output):
        modlog.debug("Calling radon.raw")
        raw(paths=[pyjen_path], summary=True)

    modlog.debug("Writing report to disk")
    raw_report = os.path.join(log_folder, "raw_stats.txt")
    with open(raw_report, "w") as fh:
        fh.write(standard_output.getvalue())
    standard_output.close()

    modlog.info("Raw code metrics generated successfully. See " +
                os.path.relpath(raw_report))