Skip to content

Commit

Permalink
Fix efel logging on windows for caching test
Browse files Browse the repository at this point in the history
  • Loading branch information
anilbey committed Oct 18, 2023
1 parent 8bfe7a4 commit 3f5e15a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions efel/cppcore/eFELLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <iostream>
#include <fstream>
#include <vector>
#include <string>

class eFELLogger
{
Expand All @@ -37,6 +38,13 @@ class eFELLogger
}
}

~eFELLogger()
{
if (logfile.is_open()) {
logfile.close();
}
}

template<typename T>
eFELLogger &operator<<(const std::vector<T> &v){
if(logging){
Expand Down
3 changes: 3 additions & 0 deletions tests/test_cppcore.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ def test_caching(self, feature_name):
efel.cppcore.getFeature(feature_name, feature_values)
with (Path(tempdir) / 'fllog.txt').open() as fd:
contents = fd.read()
# re-call efel's Initialize with current dir to remove pointer to tempdir.
# this pointer was preventing the deletion of tempdir on windows.
efel.cppcore.Initialize(efel.getDependencyFileLocation(), '.')
assert f"Calculated feature {feature_name}" in contents
assert f"Reusing computed value of {feature_name}" in contents
# make sure Calculated feature text occurs once
Expand Down

0 comments on commit 3f5e15a

Please sign in to comment.