PyDev call examples within Eclipse - Call of ExecutableΒΆ

A call example of the integration of ‘epyunit’ into Eclipse with PyDev and PyUnit. The test executable is a simple shell script named ‘myscript.sh’ demonstrating some of the major cases of integration into PyUnit. For the script code refer to CLI examples .

The integration into the PyUnit framework is coded as a test case by provided command line interface ‘epyunit’:

"""Test in PyUnit environment.
"""
from __future__ import absolute_import
from __future__ import print_function

__author__ = 'Arno-Can Uestuensoez'
__license__ = "Artistic-License-2.0 + Forced-Fairplay-Constraints"
__copyright__ = "Copyright (C) 2010-2016 Arno-Can Uestuensoez @Ingenieurbuero Arno-Can Uestuensoez"
__version__ = '0.0.1'
__uuid__ = '72d93726-cc26-46a2-a3d5-097d9f700b42'

__docformat__ = "restructuredtext en"

import unittest
import os,sys

#
# set search for the call of 'myscript.sh'
from epyunit.FileSysObjectsMin import setUpperTreeSearchPath
setUpperTreeSearchPath(None,'tests')
from epyunit.FileSysObjectsMin import findRelPathInUpperTree
from epyunit.SystemCalls import SystemCalls

#
#######################
#

class CallUnits(unittest.TestCase):
    name=os.path.curdir+__file__

    output=True
    output=False

    def testCase000(self):
        """Call first selftest part.
        """
        sx = SystemCalls(**{"proceed":"trace"})
        epy = findRelPathInUpperTree("bin/epyu.py")
        mys = findRelPathInUpperTree("myscript.sh")

        ret = sx.callit(epy+" "+mys+" xOK")

        if ret[0] == 126:
            print("check exec permissions of 'myscript.sh'", file=sys.stderr)

        assert ret[1] == "arbitrary output\n"
        assert ret[0] == 123
        assert ret[2] == ""
        pass

#
#######################
#
if __name__ == '__main__':
    unittest.main()

A setup and call example for the Eclipse integration with PyDev.

  1. Setup Eclipse and PyDev
  2. Setup PyUnit wrapper extension ePyUnit
  3. Setup call parameters
  4. Call PyUnit within Eclipse

For detailed examples refer to the subdirectories of the source package for:

  • Unit tests
  • UseCases

For examples of application as a commandline call of PyUnit refer to CLI: command line interface .