Browse Source

extract common method

python
Jørgen Lien Sellæg 7 years ago committed by Jørgen Sverre Lien Sellæg
parent
commit
ca7d9830b2
  1. 10
      tests/python_bindings/CMake_tests/cmake_test.py
  2. 5
      tests/python_bindings/CompileCommands_tests/compile_commands_test.py
  3. 5
      tests/python_bindings/jucipp_test.py

10
tests/python_bindings/CMake_tests/cmake_test.py

@ -1,12 +1,14 @@
from Jucipp import CMake
from jucipp_test import assert_equal
def run(project_path):
cmake = CMake(project_path)
assert project_path == cmake.project_path, "Construction of CMake failed"
assert_equal(project_path, cmake.project_path)
default_build_path = project_path + "/build"
assert cmake.update_default_build(default_build_path) == True, "Update of default build failed"
assert_equal(True, cmake.update_default_build(default_build_path))
executable = cmake.get_executable(default_build_path, project_path)
assert executable == default_build_path + "/cmake_project", "Invalid executable"
assert_equal(default_build_path + "/cmake_project", executable)
default_debug_path = project_path + "/debug"
assert cmake.update_debug_build(default_debug_path), "Update of debug build failed"
assert_equal(True, cmake.update_debug_build(default_debug_path))
executable = cmake.get_executable(default_debug_path, project_path)

5
tests/python_bindings/CompileCommands_tests/compile_commands_test.py

@ -2,8 +2,7 @@ from Jucipp import CompileCommands
from os import path
def assert_equal(expected, actual):
assert actual == expected, "Expected: " + expected + ", got " + actual
from jucipp_test import assert_equal
def run(project_path, slash):
build_path = project_path + slash + "build"
@ -35,4 +34,4 @@ def run(project_path, slash):
arguments = CompileCommands.get_arguments(build_path, project_path + slash + "main.cpp")
argument = arguments.pop()
assert_equal(build_path, argument)
assert_equal(build_path, argument)

5
tests/python_bindings/jucipp_test.py

@ -0,0 +1,5 @@
""" Shared test methods """
def assert_equal(expected, actual):
""" Assert two variables for equality with an useful error message """
assert actual == expected, "Expected: " + expected + ", got " + actual
Loading…
Cancel
Save