Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unittest module doesn't like compiling a main.cpp that lacks a using namespace std. #411

Open
itsjohncs opened this issue Jan 28, 2014 · 0 comments

Comments

@itsjohncs
Copy link
Contributor

Compiling a main.cpp file without a using namespace std; will make the unittest module throw an exception.

import interact.unittest
a = interact.unittest.load_files(["main.cpp"]

With the above script, the following C++ code will cause the script to raise an error.

// main.cpp
int main() {
    return 1;
}

The error is:

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    a = interact.unittest.load_files(["main.cpp"])
  File "/home/csmajs/jsull003/swig/interact/unittest.py", line 312, in load_files
    _generate_shared_libraries(modules, temp_dir)
  File "/home/csmajs/jsull003/swig/interact/unittest.py", line 112, in _generate_shared_libraries
    stderr = captured.stderr.read()
interact.unittest.CouldNotCompile: Could not compile extension module.
[Lots of stderr output omitted]

The following C++ code does not error:

// main.cpp
using namespace std;

int main() {
    return 1;
}

This is probably preventable, not sure what would cause this yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant