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

Illustration of reporter concept #3

Closed
wants to merge 1 commit into from
Closed

Illustration of reporter concept #3

wants to merge 1 commit into from

Conversation

MatthewHambley
Copy link
Contributor

This is not intended as a viable pull request; it will not run as is mostly missing. It is intended to illustrate a possible implementation being discussed in #2.
What I am showing here is implementing reporters as tree visitors. The idea being that after, or even during, execution of the tests a walk of the tree is undertaken with every registered reporter being called for each step of the walk.
This allows any number of different reports to be generated while keeping the sequencer object small. It also localises report generation to a single class per report.

@eerimoq
Copy link
Owner

eerimoq commented Feb 5, 2020

Looks interesting. Nice idea adding a test tree visitor. Feel free to proceed with the design, however, is it really necessary to use abc and six? What value do they add?

@MatthewHambley
Copy link
Contributor Author

Looks interesting. Nice idea adding a test tree visitor. Feel free to proceed with the design, however, is it really necessary to use abc and six? What value do they add?

Abstract classes are a fairly common concept in OO design. They represent a concept which is incomplete in itself and as such should never be instantiated. Instead they enforce an interface on their children, the various abstract methods must be implemented by any children of the class. Thus if you have an object which derives from this parent then you know it will have certain methods. It is most useful in a language which supports type checking but is still valuable for documenting interfaces.

As far as six is concerned, it is a Python 2.7/Python 3 compatibility layer. It allows code to work on both where normally it wouldn't. If you prefer dropping support for the now obsolete Python 2 then that would be a grade A solution from my point of view.

@eerimoq
Copy link
Owner

eerimoq commented Feb 5, 2020

I've written lots of Python classes, some which should not be instantiated (as they would not be useful), but I've never used abc and never missed it. It's usually enough to just raise NotImplementedError in the "abstract" methods.

@MatthewHambley MatthewHambley closed this by deleting the head repository Aug 10, 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.

None yet

2 participants