Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Missing logging in report #603

Merged

Conversation

BeyondEvil
Copy link
Contributor

The logging output/capture was broken in the legacy report, where "teardown" logs wasn't visible in the tests log output.

@BeyondEvil BeyondEvil requested a review from drRedflint March 25, 2023 00:08
@@ -66,11 +66,19 @@ def __init__(self, title, config):
"collectedItems": 0,
"runningState": "not_started",
"environment": {},
"tests": [],
"tests": defaultdict(list),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made a small performance improvement to avoid having to iterate through all tests, we key them with the original nodeid.

self._report.add_test(data)
self._generate_report()
if self._report.add_test(data, report):
self._generate_report()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only generate the report if we actually made a change (added a test in this case).

@@ -3,7 +3,7 @@ const { getCollapsedCategory } = require('./storage.js')
class DataManager {
setManager(data) {
const collapsedCategories = [...getCollapsedCategory(), 'passed']
const dataBlob = { ...data, tests: data.tests.map((test, index) => ({
const dataBlob = { ...data, tests: Object.values(data.tests).flat().map((test, index) => ({
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This flattens (removes the nodeid key) from the JSON data.

@@ -84,6 +84,7 @@ const dom = {
formattedDuration = formatDuration < 1 ? formattedDuration.ms : formattedDuration.formatted
const resultBody = templateResult.content.cloneNode(true)
resultBody.querySelector('tbody').classList.add(resultLower)
resultBody.querySelector('tbody').id = testId
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added this to be able to differentiate between logs using the testId.

@BeyondEvil BeyondEvil force-pushed the beyondevil/fix-missing-log-output branch from 9e4108e to 6f5c4e0 Compare March 25, 2023 00:20
@BeyondEvil BeyondEvil force-pushed the beyondevil/fix-missing-log-output branch from 6f5c4e0 to 63890ea Compare March 25, 2023 00:26
@BeyondEvil BeyondEvil merged commit 34ff60f into pytest-dev:next-gen Mar 25, 2023
@BeyondEvil BeyondEvil deleted the beyondevil/fix-missing-log-output branch March 25, 2023 22:11
BeyondEvil added a commit to BeyondEvil/pytest-html that referenced this pull request Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant