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

Test Loader: support for enable/disable docstring tags [v2] #829

Merged
merged 3 commits into from Oct 7, 2015

Conversation

clebergnu
Copy link
Contributor

Since the test loader now attempts to find Avocado instrumented tests by using a parser and doesn't really load/execute test files, it can't tell if a given class inherits from avocado.Test.

For those cases, a developer may signal, using a docstring tag, that either:

  • A test class that doesn't look like an Avocado test class is indeed one (":avocado: enable")
  • A test class that looks like an Avocado test class should not be treated as such (":avocado: disable")

Also included is a a simple optimization by breaking earlier from the parser loop.

Please test these, and for v1 I'll update the diagrams and documentations.

The documentation is on PR #828.


Changes from v1:

  • Added two more tests and suggestions by Lukáš Doktor

Changes from v0:

  • Use unittest2 on Python 2.6
  • Added fix reported by Lukáš Doktor

Sphinx will attempt to fetch the Python objects inventory during the build
process. If for some reason, this test is being run on a machine that can
not access that address simply because of network restrictions (or the
developer may simply be on a plane) then it's better to SKIP the test than
to give a false positive.

Changes from v0:
 * Use unittest2 on Python 2.6

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Inside test classes there may docstrings which may contain tags that
give special meaning. The tags are defined by ":avocado: <value>" in a
single line. For now the only two "official" Avocado tags values
exist:

 * enable: the class is an Avocado INSTRUMENTED test, even if it
   doesn't "look like" one.
 * disable: the class is *NOT* an Avocado INSTRUMENTED test, even if
   looks like one.

Changes from v0:
 * Use unittest2 on Python 2.6

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Since the test loader now attempts to find Avocado instrumented tests
by using a parser and doesn't really load/execute test files, it can't
tell if a given class inherits from avocado.Test.

For those cases, a developer may signal, using a docstring tag, that
either:

 * A test class that doesn't look like an Avocado test class is indeed
   one (":avocado: enable")
 * A test class that looks like an Avocado test class should not be
   treated as such (":avocado: disable")

Also included is a a simple optimization by breaking earlier from the
parser loop.

Changes from v1:
   * Added two more tests and suggestions by Lukáš Doktor

Changes from v0:
   * Added fix reported by Lukáš Doktor

Signed-off-by: Cleber Rosa <crosa@redhat.com>
CC: Lukáš Doktor <ldoktor@redhat.com>
@lmr lmr added the in progress label Oct 7, 2015
lmr added a commit that referenced this pull request Oct 7, 2015
Test Loader: support for enable/disable docstring tags [v2]
@lmr lmr merged commit 44605d5 into avocado-framework:master Oct 7, 2015
@lmr lmr removed the in progress label Oct 7, 2015
@clebergnu clebergnu deleted the loader_docstring_v2 branch May 4, 2016 21:47
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

3 participants