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.
Compiling a
main.cpp
file without ausing namespace std;
will make the unittest module throw an exception.With the above script, the following C++ code will cause the script to raise an error.
The error is:
The following C++ code does not error:
This is probably preventable, not sure what would cause this yet.