Comments (7)
Is the idea here of having project globals?
We already have context for module, classes and test methods. Adding support for conftest will open for requiring adding package level contexts. We can have that, but the focus right now is to deliver xml-test-case command. That said, if you want to contribute with a patch that would be awesome.
All the test collection and parsing is provided by Testimony and this function (https://github.com/SatelliteQE/testimony/blob/master/testimony/__init__.py#L58-L60) is the one that adds rules to select a test module. In addition to that will be required to update how the contexts are handled so we can add more levels.
If we have conftest and package context which one should be considered as more generic? I think the answer would be conftest, which will follow this hierarchy: conftest, then package, then module, then class and finally test method.
from betelgeuse.
Eleyezer,
The idea is kinda of like project globals I guess. I have started adding certain labels to the docstrings for my modules if they would be identical for all methods in the class(es) in the file. Just a way to simplify what goes into each function/method docstring. Effectively treating them like module level globals. Thus, I guess this would be a package (or directory) level global.
Sure, I'll take a look at writing a patch for this request. Should I open a separate issue in testimony?
As for order of priority for the context levels, I would have thought package then conftest. TBH my initial thought was super simple just add conftest.py support like any other module. Then just require defining in only one place or you could get strange results. Can't you have multiple directories with different conftests in a single package?
package/__init.py
package/dir1/{conftest.py, test_feature1.py}
package/dir2/{conftest.py, test_feature2.py}
Also, you're thinking the package level contexts should be included in init.py right?
Thanks,
Scott
from betelgeuse.
I am not sure if multiple conftest.py can exist inside the same package. If we decide on supporting multiple conftest we need to improve even more the contexts so conftest higher in the directory tree will be used if in a subdirectory does not have one, else the subdirectory will override the more generic one. Thinking a little bit more about that, I think we should only support package level context and don't support conftest at all. Package context will help on have globals and that is more suited for every test runner.
Yes, package level should analyze the __init__.py
docstring.
from betelgeuse.
I guess this depends on test coding style. You can have multiple conftest.py files in a directory tree that isn't necessarily a python package. Each conftest.py applies to the tests in its own directory. For example, my team simply installs our tests from git and executes py.test command. We have test "suites" as separate directories with separate conftest.py files.
As for order of precedence, the conftest in the subdirectory "should" override the one in a parent directory I think. The data closest to the test should be the most "authoritative", right? At least in how we're talking about processing docstrings?
That is still a good point about having to maintain parent directory conftest data to fully support that. Maybe just __init__.py
is right for the start. I think that's definitely the easier path. There is no sub-directory/child-node type inheritance expected there right? Even if groups aren't using packages, they could add __init__.py
files to directories to supply directory level defaults for their test modules.
My first draft was for conftest but, I'll modify for __init__
and go from there. If we decide to include conftest later, it can be added separately, I think.
from betelgeuse.
Either way is fine to me, subpackages inherit tokens from parent packages or only the modules within a package inherit from its __init__.py
file.
About conftest, yes I agree that having package context will open even more the possibilities, then we can check if supporting conftest will continue being required.
from betelgeuse.
I didn't realize this one was still open. I think it can be closed now right? We just support the init.py docstrings instead of the conftest ones I originally suggested right?
from betelgeuse.
@spoore1 yeah we can close this. Thank you!
from betelgeuse.
Related Issues (20)
- upstream token is not valid across different project, make it editable only when present HOT 1
- Provide RST parsing errors and warnings
- We should be able to pass some tokens (Requirement,CaseLevel, CaseImportance, TestType, etc.) through command line HOT 2
- Please add Requirement and Automation Script fields to be used by Betelgeuse Configuration Module HOT 1
- Make use of <testcase status-id="approved"> to update Test Case status HOT 1
- Provide help message for the --config-module option
- Document a list of custom fields and its values - IDs in Polarion HOT 2
- allow '.' as test path
- Allow sending files to Polarion HOT 4
- Request to parse multiple lines for fields like "title" in docstrings HOT 2
- Make Betelgeuse Python 3.6+ only HOT 7
- Update the betelgeuse requirement command to generate the XML for the Requirement Importer
- Pytest style parametrization HOT 6
- test case id not derived by test-run
- [test-case] Higher-level metadata might be used when keys use inconsistent casing
- pylarion now supporting python 3 HOT 2
- Traceback when running betelgeuse for insights tests HOT 2
- "betelgeuse test-run --status inprogress" isnt updating the test-run correctly HOT 3
- AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren' with Python 3.9 HOT 2
- Move to Github Actions
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from betelgeuse.