<commit_before>"""
@brief      test log(time=2s)

skip this test for regular run
"""

import sys
import os
import unittest
import re
import pandas

try:
    import src
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..")))
    if path not in sys.path:
        sys.path.append(path)
    import src

try:
    import pyquickhelper
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..",
                "..",
                "pyquickhelper",
                "src")))
    if path not in sys.path:
        sys.path.append(path)
    if "PYQUICKHELPER" in os.environ and len(os.environ["PYQUICKHELPER"]) > 0:
        sys.path.append(os.environ["PYQUICKHELPER"])
    import pyquickhelper


from pyquickhelper import fLOG, df2rst
from src.pymyinstall.installhelper import run_cmd


class TestScriptInstall(unittest.TestCase):

    def test_script_help(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        script = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_install.py")
        assert os.path.exists(script)
        scriptu = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_update.py")
        assert os.path.exists(script)

        exe = sys.executable

        cmd = exe + " " + script + " --help"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        if "usage: pymy_install.py" not in out:
            raise Exception(out)

        cmd = exe + " " + scriptu + " --help"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        if "usage: pymy_update.py" not in out:
            raise Exception(out)

    def test_script_schedule(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        script = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_install.py")
        assert os.path.exists(script)
        scriptu = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_update.py")
        assert os.path.exists(script)

        exe = sys.executable

        cmd = exe + " " + script + " --schedule --set=minimal"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        fLOG(out)
        fLOG("---")
        fLOG(err)
        if "check module:  flake8" not in out:
            raise Exception(out)

        cmd = exe + " " + scriptu + " --schedule --set=minimal"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        if "check module:  flake8" not in out:
            raise Exception(out)


if __name__ == "__main__":
    unittest.main()
<commit_msg>disable a test on py2.7<commit_after>"""
@brief      test log(time=2s)

skip this test for regular run
"""

import sys
import os
import unittest
import re
import pandas

try:
    import src
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..")))
    if path not in sys.path:
        sys.path.append(path)
    import src

try:
    import pyquickhelper
except ImportError:
    path = os.path.normpath(
        os.path.abspath(
            os.path.join(
                os.path.split(__file__)[0],
                "..",
                "..",
                "..",
                "pyquickhelper",
                "src")))
    if path not in sys.path:
        sys.path.append(path)
    if "PYQUICKHELPER" in os.environ and len(os.environ["PYQUICKHELPER"]) > 0:
        sys.path.append(os.environ["PYQUICKHELPER"])
    import pyquickhelper


from pyquickhelper import fLOG, df2rst
from src.pymyinstall.installhelper import run_cmd


class TestScriptInstall(unittest.TestCase):

    def test_script_help(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        script = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_install.py")
        assert os.path.exists(script)
        scriptu = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_update.py")
        assert os.path.exists(script)

        exe = sys.executable

        cmd = exe + " " + script + " --help"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        if "usage: pymy_install.py" not in out:
            raise Exception(out)

        cmd = exe + " " + scriptu + " --help"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        if "usage: pymy_update.py" not in out:
            raise Exception(out)

    def test_script_schedule(self):
        fLOG(
            __file__,
            self._testMethodName,
            OutputPrint=__name__ == "__main__")

        script = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_install.py")
        assert os.path.exists(script)
        scriptu = os.path.join(os.path.dirname(os.path.abspath(
            __file__)), "..", "..", "src", "pymyinstall", "scripts", "pymy_update.py")
        assert os.path.exists(script)

        exe = sys.executable

        cmd = exe + " " + script + " --schedule --set=minimal"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        fLOG(out)
        fLOG("---")
        fLOG(err)
        if "check module:  flake8" not in out and sys.version_info[0] > 2:
            raise Exception(out + "\nERR:\n" + str(err))

        cmd = exe + " " + scriptu + " --schedule --set=minimal"
        out, err = run_cmd(cmd, wait=True, fLOG=fLOG)
        if "check module:  flake8" not in out and sys.version_info[0] > 2:
            raise Exception(out + "\nERR:\n" + str(err))


if __name__ == "__main__":
    unittest.main()

{'fraction_non_alphanumeric': 0.14406240050939192, 'fraction_numerical': 0.003183699458771092, 'mean_word_length': 1.9553151458137348, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5619496', 'n_tokens_mistral': 2136, 'n_tokens_neox': 2055, 'n_words': 434}