Skip to content

Commit

Permalink
Merge pull request #111 from swryan/109_deprecations
Browse files Browse the repository at this point in the history
Fixed deprecations report to handle SubTests, Fixed duration of SubTests
  • Loading branch information
swryan authored May 17, 2024
2 parents 16c6d10 + a539776 commit c45ee07
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ jobs:
# test on Ubuntu
- NAME: Ubuntu Baseline
OS: ubuntu-latest
PY: '3.11'
PY: '3.12'

# test on MacOS
- NAME: MacOS Baseline
OS: macos-latest
PY: '3.11'
PY: '3.12'

runs-on: ${{ matrix.OS }}

Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
run: |
cd $HOME
testflo testflo.tests || RC=$?
testflo testflo.tests -vs --show_skipped --durations=5 --durations-min=0 --deprecations_report dep.txt || RC=$?
if [[ $RC -ne 1 ]]; then
echo "Expected some tests to fail."
Expand All @@ -104,11 +104,14 @@ jobs:
exit 11
fi
grep "Deprecations Report" dep.txt
rm dep.txt
- name: Run tests in serial
run: |
cd $HOME
testflo -n 1 testflo.tests || RC=$?
testflo testflo.tests -n 1 -vs --show_skipped --durations=5 --durations-min=0 --deprecations_report dep.txt || RC=$?
if [[ $RC -ne 1 ]]; then
echo "Expected some tests to fail."
Expand All @@ -135,6 +138,9 @@ jobs:
exit 11
fi
grep "Deprecations Report" dep.txt
rm dep.txt
- name: Notify slack of failure
uses: act10ns/[email protected]
with:
Expand Down
9 changes: 5 additions & 4 deletions testflo/deprecations.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@ def get_iter(self, input_iter):

deprecations = {}

for test in input_iter:
for msg, locs in test.deprecations.items():
deprecations[msg] = deprecations.get(msg, set()) | locs
yield test
for tests in input_iter:
for test in tests:
for msg, locs in test.deprecations.items():
deprecations[msg] = deprecations.get(msg, set()) | locs
yield test

report = self.generate_report(deprecations)

Expand Down
4 changes: 3 additions & 1 deletion testflo/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,13 @@ def run(self, queue=None):
else:
stream_val = ''
if ut_subtests:
end_time = time.perf_counter()
for sub, err in ut_subtests:
subtest = SubTest(sub._subDescription(), self.spec, self.options)
subtest.status = status
subtest.err_msg = stream_val + err
subtest.end_time = time.perf_counter()
subtest.start_time = self.start_time
subtest.end_time = end_time
subtest.memory_usage = get_memory_usage()
subs.append(subtest)
else:
Expand Down

0 comments on commit c45ee07

Please sign in to comment.