Skip to content

Autoinject code? Coverage/performance/others simplification #192

Description

@eldipa

Describe the feature you'd like
byexample allows to run arbitrary code at some points during the execution. These hooks points are described in the Concern interface.

One use case for these concerns/hooks is to enable coverage: the coverage system is initialized at the begin of the execution and at the end it generates a dump with the stats.

An example of this is the coverage.py of byexample.

Other cases could be:

  • enabling measure of performance for the whole execution or per example
  • enabling debug logs

These are the orthogonal things for what Concern was designed for.

But creating a Concern subclass, implement some of its methods in Python it may be to complex, specially for people coming from other languages.

It could be much nicer just say:

byexample -l ruby --enable-ruby-coverage <files>

But that is perhaps too much for byexample.

A tradeoff could be:

byexample -l ruby --inject "ruby:begin:<file>" --inject "ruby:end:<file>"  <files>

More cryptic, sure, but more general too: byexample could inject a ruby file at the begin and at the end of the execution.

byexample doesn't need to know about coverage/performance/debug/etc and the user doesn't need to know about Python and the Concern interface.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsomething nice to have but it is not neither critical nor urgentrequest for commentsa draft idea that needs more brainstorming, comments are welcome!

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions