<filename>testtools/env_tests.py<gh_stars>10-100
"""
Includes tests that check the setup for the tests.
If the library is compiled and if there is a crystal interpreter.
"""
import os
#import sys
import unittest
import tempfile

class EnviromentTest(unittest.TestCase):
    """Test case that makes sure that the environment is up and working"""

    py2cr_dot_cr = "lib/py2cr/src/py2cr.cr"
    crystal = "crystal"

    def reportProgres(self) -> None:
        """Should be overloaded by the test result class"""

    def stop(self) -> None:
        """Should be overloaded by the test result class"""

    def runTest(self) -> None:
        """The actual test goes here."""
        tmpfile = os.path.join(tempfile.gettempdir(), tempfile.gettempprefix())
        if os.system(f"{self.crystal} --help > {tmpfile}"):
            self.stop()
            raise RuntimeError(f"Can't find the '{self.crystal}' command.")
        self.reportProgres()

        if not os.path.exists(self.py2cr_dot_cr):
            self.stop()
            raise RuntimeError(f"Can't find '{self.py2cr_dot_cr}'.")
        self.reportProgres()

    def __str__(self) -> str:
        return f"Looking for '{self.crystal}', '{self.py2cr_dot_cr}' [3]:"

<filename>testtools/env_tests.py<gh_stars>10-100
"""
Includes tests that check the setup for the tests.
If the library is compiled and if there is a crystal interpreter.
"""
import os
#import sys
import unittest
import tempfile

class EnviromentTest(unittest.TestCase):
    """Test case that makes sure that the environment is up and working"""

    py2cr_dot_cr = "lib/py2cr/src/py2cr.cr"
    crystal = "crystal"

    def reportProgres(self) -> None:
        """Should be overloaded by the test result class"""

    def stop(self) -> None:
        """Should be overloaded by the test result class"""

    def runTest(self) -> None:
        """The actual test goes here."""
        tmpfile = os.path.join(tempfile.gettempdir(), tempfile.gettempprefix())
        if os.system(f"{self.crystal} --help > {tmpfile}"):
            self.stop()
            raise RuntimeError(f"Can't find the '{self.crystal}' command.")
        self.reportProgres()

        if not os.path.exists(self.py2cr_dot_cr):
            self.stop()
            raise RuntimeError(f"Can't find '{self.py2cr_dot_cr}'.")
        self.reportProgres()

    def __str__(self) -> str:
        return f"Looking for '{self.crystal}', '{self.py2cr_dot_cr}' [3]:"

Includes tests that check the setup for the tests. If the library is compiled and if there is a crystal interpreter. #import sys Test case that makes sure that the environment is up and working Should be overloaded by the test result class Should be overloaded by the test result class The actual test goes here.