Ejemplo n.º 1
0
def test():
    """Tests package"""
    error_codes = []
    print("Python Tests:")
    error_codes.append(xnt.setup(["test"]))
    clean()
    if xnt.in_path("python2"):
        print("Python2 Tests:")
        error_codes.append(xnt.call(["python2", "setup.py", "test"]))
        clean()
    return sum(error_codes)
Ejemplo n.º 2
0
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.

#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

import os
import shutil
import xnt
import xnt.build.cc as cc
import unittest

#pylint: disable-msg=C0103
@unittest.skipUnless(xnt.in_path("gcc"), "gcc is not in your path")
class GccTests(unittest.TestCase):
    """Test GCC"""
    def setUp(self):
        """Test Case Setup"""
        os.mkdir("temp")
        with open("temp/hello.c", "w") as test_code:
            test_code.write("""
            #include <stdio.h>
            int main() {
                printf("Hello, World!\\n");
                return 0;
            }
            """)

    def tearDown(self):
Ejemplo n.º 3
0
#   (at your option) any later version.

#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.

#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

import unittest
import xnt
import xnt.build.make
import xnt.tests

@unittest.skipUnless(xnt.in_path("ant") or xnt.in_path("ant.exe"),
                     "Apache ant is not in your path")
class AntTests(unittest.TestCase):
    """Test Case for Ant Build"""
    def setUp(self):
        """Test Setup"""
        xnt.tests.set_up()
        with open("temp/build.xml", "w") as build:
            build.write("<?xml version=\"1.0\" ?>\n")
            build.write("<project name=\"test\" default=\"test\">\n")
            build.write("<target name=\"test\">\n")
            build.write("<echo>${test_var}</echo>\n")
            build.write("</target>\n")
            build.write("</project>\n")

    def tearDown(self):
Ejemplo n.º 4
0
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.

#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.

import os
import unittest
import xnt
import xnt.build.tex
import xnt.tests

@unittest.skipUnless(xnt.in_path("pdflatex") or xnt.in_path("pdflatex.exe"),
                     "pdflatex is not in your path")
class TexTests(unittest.TestCase):
    """Test Case for TeX Document Building"""

    def setUp(self):
        """Test Setup"""
        xnt.tests.set_up()
        with open("temp/test.tex", "w") as test_tex:
            test_tex.write('\\documentclass{article}\n')
            test_tex.write('\\usepackage{glossaries}\n')
            test_tex.write('\\author{python test}\n')
            test_tex.write('\\date{\\today}\n')
            test_tex.write('\\makeglossaries\n')
            test_tex.write('\\begin{document}\n')
            test_tex.write('\\nocite{*}\n')