Ejemplo n.º 1
0
    def test_mi(self, harv_mock, log_mock):
        harv_mock.return_value = mock.sentinel.harvester

        cli.mi(['-'], show=True, multi=False)

        harv_mock.assert_called_once_with(['-'], cli.Config(
            min='A', max='C', exclude=None, ignore=None, show=True,
            multi=False))
        log_mock.assert_called_once_with(mock.sentinel.harvester, json=False)
Ejemplo n.º 2
0
    def test_mi(self, harv_mock, log_mock):
        harv_mock.return_value = mock.sentinel.harvester

        cli.mi(['-'], show=True, multi=False)

        harv_mock.assert_called_once_with(['-'], cli.Config(
            min='A', max='C', exclude=None, ignore=None, show=True,
            multi=False))
        log_mock.assert_called_once_with(mock.sentinel.harvester, json=False)
Ejemplo n.º 3
0
def test_mi(mocker, log_mock):
    harv_mock = mocker.patch('radon.cli.MIHarvester')
    harv_mock.return_value = mocker.sentinel.harvester

    cli.mi(['-'], show=True, multi=False)

    harv_mock.assert_called_once_with(['-'], cli.Config(
        min='A', max='C', exclude=None, ignore=None, show=True,
        multi=False, sort=False))
    log_mock.assert_called_once_with(mocker.sentinel.harvester, json=False)
Ejemplo n.º 4
0
def _run_mi_analysis():
    """Generates maintainability index statistics for the package"""
    modlog.debug("Running maintainability index")
    pyjen_path = os.path.join(os.getcwd(), "pyjen")
    from radon.cli import mi

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

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

    modlog.info("Maintainability index metrics generated successfully. See " + os.path.relpath(mi_report))
Ejemplo n.º 5
0
Archivo: run.py Proyecto: tylerml/pyjen
def _run_mi_analysis():
    """Generates maintainability index statistics for the package"""
    modlog.debug("Running maintainability index")
    pyjen_path = os.path.join(os.getcwd(), "pyjen")
    from radon.cli import mi

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

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

    modlog.info("Maintainability index metrics generated successfully. See " +
                os.path.relpath(mi_report))