Browse Source

fix test logic

blueloveTH 1 year ago
parent
commit
14a9120d9b
2 changed files with 3 additions and 3 deletions
  1. 0 3
      src2/main.cpp
  2. 3 0
      tests/30_import.py

+ 0 - 3
src2/main.cpp

@@ -99,9 +99,6 @@ int main(int argc, char** argv){
         std::string src((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
         std::string src((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
         file.close();
         file.close();
 
 
-        // set parent path as cwd
-        std::filesystem::current_path(filepath.parent_path());
-
         bool ok = pkpy_exec_2(vm, src.c_str(), filepath.filename().string().c_str(), 0, NULL);
         bool ok = pkpy_exec_2(vm, src.c_str(), filepath.filename().string().c_str(), 0, NULL);
         if(!ok) pkpy_clear_error(vm, NULL);
         if(!ok) pkpy_clear_error(vm, NULL);
         pkpy_delete_vm(vm);
         pkpy_delete_vm(vm);

+ 3 - 0
tests/30_import.py

@@ -3,6 +3,9 @@ try:
 except ImportError:
 except ImportError:
     exit(0)
     exit(0)
 
 
+# test import
+os.chdir('tests')
+
 import test1
 import test1
 
 
 assert test1.add(1, 2) == 13
 assert test1.add(1, 2) == 13