8000 Fixed CustomLogger super call by mattp- · Pull Request #2849 · ansible/molecule · GitHub
[go: up one dir, main page]

Skip to content

Fixed CustomLogger super call - #2849

Merged
ssbarnea merged 1 commit into
ansible:masterfrom
mattp-:master
Oct 1, 2020
Merged

ssbarnea merged 1 commit into
ansible:masterfrom
mattp-:master

Conversation

@mattp-
@mattp- mattp- commented Sep 28, 2020
Copy link
Copy Markdown
Contributor

In cases where another logger uses getLoggerClass to subclass and then
setLoggerClass's itself, molecules logger passes the wrong value to
super() causing a recursionError.

Please include details of what it is, how to use it, how it's been tested

PR Type

  • Bugfix Pull Request

@ssbarnea
Copy link
Copy Markdown
Member

@mattp- please rebase, we fixed the unrelated CI failures.

Comment thread molecule/test/unit/test_logger.py Outdated
Comment on lines +193 to +194
except RecursionError as exc:
raise pytest.fail("CustomLogger caused recursion error: {0}".format(exc))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why are you catching this, and not just letting the error pass out to pytest automatically?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

not sure, I guess that also works :) ill change

@mattp-
mattp- force-pushed the master branch 3 times, most recently from 87c529e to c685343 Compare September 30, 2020 18:15
@greg-hellings
Copy link
Copy Markdown
Contributor

You accidentally made an extra test and it passes. Somewhere in the test code you'll see definitions for how many tests there are supposed to be. You'll need to bump that up to 433 to account for your additional test.

In cases where another logger uses getLoggerClass to subclass and then
setLoggerClass's itself,  molecules logger passes the wrong value to
super() causing a recursionError.
@mattp-
mattp- commented Sep 30, 2020
Copy link
Copy Markdown
Contributor Author

@greg-hellings should be good now I believe, pending that last build-containers task. thanks!

@greg-hellings greg-hellings left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@ssbarnea ssbarnea changed the title call super on CustomLogger, not getLoggerClass() Fixed CustomLogger super call Oct 1, 2020
@ssbarnea
ssbarnea merged commit 20e1fa8 into ansible:master Oct 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0