Fix test script paths (#3387)

* fix path to task executable in pyton tests

The current approach would copy the current files into the `build/test`
directory. Updating the paths according to the custom user setup.

By the copy I appended `.py` to have a clear visible distingtion which
ones are the python tests.

As soon as a source file in the normal directory is changed, it is
copied over and the corresponding file is updated.

From now on the python tests would need to get run in the according
build directory.

* reflect the current build instruction in PR template

* update paths and globing in run_all

* add line break for every cpp test

* remove .gitignore in test folder

As now all the auxillary files such as `all.log` as well as the
executables are present in the `build` directory there is no longer a
need to ignore them.

* update paths in python test scripts and enable deactivated

* remove .py extension when copy to build

Further remove glob pattern for `*.t.py` tests.

* remove accidentally added template.t from test files
This commit is contained in:
Felix Schurk 2024-04-28 22:38:14 +03:00 committed by GitHub
parent 7dba5e7695
commit d093ce3d84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 179 additions and 50 deletions

View file

@ -5,7 +5,7 @@ Replace this text with a description of the PR.
#### Additional information... #### Additional information...
- [ ] I changed C++ code or build infrastructure. - [ ] I changed C++ code or build infrastructure.
Please run the test suite and include the output of `cd test && ./problems`. Please run the test suite and include the output of `cd build/test && make && ./problems`.
- [ ] I changed Rust code or build infrastructure. - [ ] I changed Rust code or build infrastructure.
Please run `cargo test` and address any failures before submitting. Please run `cargo test` and address any failures before submitting.

41
test/.gitignore vendored
View file

@ -1,41 +0,0 @@
*.o
*.pyc
*.data
*.sqlite3
*.log
*.runlog
col.t
dom.t
eval.t
lexer.t
t.t
taskmod.t
tdb2.t
uri.t
util.t
variant_add.t
variant_and.t
variant_cast.t
variant_divide.t
variant_equal.t
variant_exp.t
variant_gt.t
variant_gte.t
variant_inequal.t
variant_lt.t
variant_lte.t
variant_match.t
variant_math.t
variant_modulo.t
variant_multiply.t
variant_nomatch.t
variant_not.t
variant_or.t
variant_partial.t
variant_subtract.t
variant_xor.t
view.t
tc.t
tw-2689.t
json_test

View file

@ -18,7 +18,39 @@ include_directories (${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/taskchampion/lib ${CMAKE_SOURCE_DIR}/taskchampion/lib
${TASK_INCLUDE_DIRS}) ${TASK_INCLUDE_DIRS})
set (test_SRCS col.t dom.t eval.t lexer.t t.t tw-2689.t tdb2.t tc.t util.t variant_add.t variant_and.t variant_cast.t variant_divide.t variant_equal.t variant_exp.t variant_gt.t variant_gte.t variant_inequal.t variant_lt.t variant_lte.t variant_match.t variant_math.t variant_modulo.t variant_multiply.t variant_nomatch.t variant_not.t variant_or.t variant_partial.t variant_subtract.t variant_xor.t view.t) set (test_SRCS
col.t
dom.t
eval.t
lexer.t
t.t
tw-2689.t
tdb2.t
tc.t
util.t
variant_add.t
variant_and.t
variant_cast.t
variant_divide.t
variant_equal.t
variant_exp.t
variant_gt.t
variant_gte.t
variant_inequal.t
variant_lt.t
variant_lte.t
variant_match.t
variant_math.t
variant_modulo.t
variant_multiply.t
variant_nomatch.t
variant_not.t
variant_or.t
variant_partial.t
variant_subtract.t
variant_xor.t
view.t
)
add_custom_target (test ./run_all --verbose add_custom_target (test ./run_all --verbose
DEPENDS ${test_SRCS} task_executable DEPENDS ${test_SRCS} task_executable
@ -37,6 +69,135 @@ endforeach (src_FILE)
configure_file(run_all run_all COPYONLY) configure_file(run_all run_all COPYONLY)
configure_file(problems problems COPYONLY) configure_file(problems problems COPYONLY)
configure_file(bash_tap.sh bash_tap.sh COPYONLY)
configure_file(bash_tap_tw.sh bash_tap_tw.sh COPYONLY)
add_subdirectory(basetest)
add_subdirectory(simpletap)
set (pythonTests
abbreviation.t
add.t
alias.t
annotate.t
append.t
args.t
bash_completion.t
blocked.t
bulk.t
burndown.t
calc.t
calendar.t
caseless.t
color.cmd.t
color.rules.t
columns.t
commands.t
completed.t
configuration.t
confirmation.t
context.t
count.t
custom.config.t
custom.recur_ind.t
custom.t
custom.tag_ind.t
date.iso.t
dateformat.t
datesort.t
datetime-negative.t
debug.t
default.t
delete.t
denotate.t
dependencies.t
diag.t
diag_color.t
dom2.t
due.t
duplicate.t
edit.t
encoding.t
enpassant.t
exec.t
export.t
feature.559.t
feature.default.project.t
feature.print.empty.columns.t
feature.recurrence.t
feedback.t
filter.t
fontunderline.t
format.t
gc.t
helpers.t
history.t
hooks.env.t
hooks.on-add.t
hooks.on-launch.t
hooks.on-modify.t
hyphenate.t
ids.t
import.t
info.t
limit.t
list.all.projects.t
log.t
logo.t
math.t
modify.t
nag.t
obfuscate.t
oldest.t
operators.t
overdue.t
partial.t
prepend.t
pri_sort.t
project.t
quotes.t
rc.override.t
recurrence.t
reports.t
search.t
sequence.t
shell.t
show.t
sorting.t
special.t
start.t
stats.t
substitute.t
sugar.t
summary.t
tag.t
taskrc.t
timesheet.t
tw-1379.t
tw-1837.t
tw-20.t
tw-2575.t
tw-262.t
tw-295.t
uda.t
uda_orphan.t
uda_report.t
uda_sort.t
undo.t
unicode.t
unique.t
upgrade.t
urgency.t
urgency_inherit.t
uuid.t
verbose.t
version.t
wait.t
hooks.on-exit.t
)
foreach (python_Test ${pythonTests})
configure_file(${python_Test} ${python_Test} COPYONLY)
endforeach(python_Test)
#SET(CMAKE_BUILD_TYPE gcov) #SET(CMAKE_BUILD_TYPE gcov)
#SET(CMAKE_CXX_FLAGS_GCOV "--coverage") #SET(CMAKE_CXX_FLAGS_GCOV "--coverage")

View file

@ -0,0 +1,8 @@
configure_file(__init__.py __init__.py COPYONLY)
configure_file(compat.py compat.py COPYONLY)
configure_file(exceptions.py exceptions.py COPYONLY)
configure_file(hooks.py hooks.py COPYONLY)
configure_file(meta.py meta.py COPYONLY)
configure_file(task.py task.py COPYONLY)
configure_file(testing.py testing.py COPYONLY)
configure_file(utils.py utils.py)

View file

@ -29,17 +29,17 @@ CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
# Location of binary files (usually the src/ folder) # Location of binary files (usually the src/ folder)
BIN_PREFIX = os.path.abspath( BIN_PREFIX = os.path.abspath(
os.path.join(CURRENT_DIR, "..", "..", "src") os.path.join("${CMAKE_BINARY_DIR}","src")
) )
# Default location of test certificates # Default location of test certificates
DEFAULT_CERT_PATH = os.path.abspath( DEFAULT_CERT_PATH = os.path.abspath(
os.path.join(CURRENT_DIR, "..", "test_certs") os.path.join("${CMAKE_SOURCE_DIR}", "test", "test_certs")
) )
# Default location of test hooks # Default location of test hooks
DEFAULT_HOOK_PATH = os.path.abspath( DEFAULT_HOOK_PATH = os.path.abspath(
os.path.join(CURRENT_DIR, "..", "test_hooks") os.path.join("${CMAKE_SOURCE_DIR}", "test", "test_hooks")
) )

View file

@ -36,7 +36,7 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from basetest import Task, TestCase from basetest import Task, TestCase
from basetest.utils import BIN_PREFIX from basetest.utils import BIN_PREFIX
TASKSH = os.path.abspath(os.path.join(BIN_PREFIX, "..", "scripts/bash/task.sh")) TASKSH = os.path.abspath(os.path.join(BIN_PREFIX, "..", "..", "scripts/bash/task.sh"))
@contextmanager @contextmanager

View file

@ -70,7 +70,7 @@ class TestRunner(object):
self._outputq = Queue() self._outputq = Queue()
def _find_tests(self): def _find_tests(self):
for test in glob.glob("*.t") + glob.glob("*.t.exe"): for test in glob.glob("*.t"):
if os.access(test, os.X_OK): if os.access(test, os.X_OK):
# Executables only # Executables only
if self._is_parallelizable(test): if self._is_parallelizable(test):
@ -123,7 +123,7 @@ class TestRunner(object):
with open(test, 'rb') as fh: with open(test, 'rb') as fh:
header = fh.read(100).split(b"\n") header = fh.read(100).split(b"\n")
if len(header) >= 2 and \ if len(header) >= 2 and \
((b"/usr/bin/env python3" in header[0]) or \ ((b"!#/usr/bin/env python3" in header[0]) or \
(header[1][-14:] == b"bash_tap_tw.sh")): (header[1][-14:] == b"bash_tap_tw.sh")):
return True return True
else: else:

View file

@ -0,0 +1 @@
configure_file(__init__.py __init__.py COPYONLY)

0
test/template.t Normal file → Executable file
View file

View file

@ -41,7 +41,7 @@ class TestBug1379(TestCase):
self.t = Task() self.t = Task()
# Themes are a special case that cannot be set via "task config" # Themes are a special case that cannot be set via "task config"
with open(self.t.taskrc, 'a') as fh: with open(self.t.taskrc, 'a') as fh:
fh.write("include " + REPO_DIR + "/doc/rc/no-color.theme\n") fh.write("include " + REPO_DIR + "/../doc/rc/no-color.theme\n")
self.t.config("color.alternate", "") self.t.config("color.alternate", "")
self.t.config("_forcecolor", "1") self.t.config("_forcecolor", "1")

0
test/tw-1837.t Normal file → Executable file
View file

0
test/tw-2575.t Normal file → Executable file
View file