Skip to content

Commit

Permalink
add regression test for kdcraw
Browse files Browse the repository at this point in the history
  • Loading branch information
wlav committed Oct 25, 2017
1 parent 60b3c5a commit f18aa2e
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 4 deletions.
10 changes: 8 additions & 2 deletions python/cppyy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
""" Dynamic C++ bindings generator.
"""

import os, sys

try:
import __pypy__
del __pypy__
Expand All @@ -15,10 +17,8 @@


#- allow importing from gbl --------------------------------------------------
import sys
sys.modules['cppyy.gbl'] = gbl
sys.modules['cppyy.gbl.std'] = gbl.std
del sys


#- enable auto-loading -------------------------------------------------------
Expand Down Expand Up @@ -52,6 +52,12 @@ def include(header):
"""Load (and JIT) header file <header> into Cling."""
gbl.gInterpreter.ProcessLine('#include "%s"' % header)

def add_include_path(path):
"""Add a path to the include paths available to cling"""
if not os.path.isdir(path):
raise OSError("no such directory: %s" % path)
gbl.gInterpreter.AddIncludePath(path)

def _get_name(tt):
try:
ttname = tt.__cppname__
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

setup(
name='cppyy',
version='0.8.0',
version='0.8.1',
description='Cling-based Python-C++ bindings',
long_description=long_description,

Expand All @@ -51,7 +51,7 @@
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: Implementation :: PyPy',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: C',
'Programming Language :: C++',

Expand Down
36 changes: 36 additions & 0 deletions test/test_regression.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import py, os, sys
from pytest import raises
from .support import setup_make

currpath = py.path.local(__file__).dirpath()


class TestREGRESSION:
def setup_class(cls):
import cppyy

def test01_kdcraw(self):
"""Template member functions lookup and calls"""

import cppyy

# TODO: run a find for these paths
qtpath = "/usr/include/qt5"
kdcraw_h = "/usr/include/KF5/KDCRAW/kdcraw/kdcraw.h"
if not os.path.isdir(qtpath) or not os.path.exists(kdcraw_h):
import warnings
warnings.warn("no KDE/Qt found, skipping test01_kdcraw")
return

cppyy.add_include_path(qtpath)
cppyy.include(kdcraw_h)

from cppyy.gbl import KDcrawIface
help(KDcrawIface)

def test02_dir(self):
"""For the same reasons as test01_kdcraw, this used to crash."""

import cppyy

help(cppyy.gbl.gInterpreter)

0 comments on commit f18aa2e

Please sign in to comment.