Closed
Bug 725452
Opened 14 years ago
Closed 14 years ago
separate out configuration part of testfile
Categories
(Testing :: Talos, defect)
Testing
Talos
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: k0scist, Assigned: jmuel11)
References
Details
(Whiteboard: [good first bug][mentor=jhammel][lang=py])
http://hg.mozilla.org/build/talos/file/2f1597742374/talos/run_tests.py#l402
The first part of the test file function basically reads a yml file
and applies the overrides from the CLI parser. It would be *nice*
being able write tests to make sure the configuration is sane, but
since running the tests themselves are in the same section, we can't.
Instead, we should have a function, e.g. `def configuration` that
basically does up to
http://hg.mozilla.org/build/talos/file/2f1597742374/talos/run_tests.py#l421
of that function.
Then testfile can just take a configuration object and call it a day,
*and* we can test configuration programmatically.
| Reporter | ||
Updated•14 years ago
|
| Assignee | ||
Comment 1•14 years ago
|
||
I'd be interested in taking a look at this. As far as I can tell you just want to have an object that takes in a file in the constructor and stores all of the relevant information from the configuration file?
| Assignee | ||
Updated•14 years ago
|
Assignee: nobody → jmuel11
| Assignee | ||
Comment 2•14 years ago
|
||
Ok, I'm not sure how good my python is these days so I'm going to put this here as an insanity check. Right now I've taken that code segment you pointed out and put it into a class.
class configHolder(object):
def _init_(self, filename):
config_file = open(filename, 'r')
self.yaml_config = yaml.load(config_file)
self.tests = yaml_config['tests']
self.tests = useBaseTestDefaults(self.yaml_config.get('basetest',[]), tests)
Let me know if I'm doing anything straight out dumb.
| Reporter | ||
Comment 3•14 years ago
|
||
I think I'm going to take bug 704654 and try a fairly major refactor this weekend of how configuration works with Talos which may impact this bug, so it may be best to hold off on this bug in a bit
I'm not sure if a class is the best solution to this problem. I was just thinking of a function that is called at the top of test_file that returns the resultant configuration dictionary using the code from the top of test_file. This way, tests may be written which do not involve starting the browser.
| Assignee | ||
Comment 4•14 years ago
|
||
Ok, I'll hold up on changing things for now. I'm thinking more in terms of C and Java which is why I asked. Is this closer to what you'd want?
def create_config(filename):
config_file = open(filename, 'r')
yaml_config = yaml.load(config_file)
config_file.close()
tests = yaml_config['tests']
tests = useBaseTestDefaults(yaml_config.get('basetest', []), tests)
return {'yaml_config':yaml_config, 'tests':tests}
| Reporter | ||
Comment 5•14 years ago
|
||
(In reply to James Mueller from comment #4)
> Ok, I'll hold up on changing things for now. I'm thinking more in terms of C
> and Java which is why I asked. Is this closer to what you'd want?
>
> def create_config(filename):
> config_file = open(filename, 'r')
> yaml_config = yaml.load(config_file)
> config_file.close()
> tests = yaml_config['tests']
> tests = useBaseTestDefaults(yaml_config.get('basetest', []), tests)
> return {'yaml_config':yaml_config, 'tests':tests}
Yes, that is the basic idea. I'll keep you up to date as my patch nears maturity: this may still be necessary or I may just absorb it in what I'm doing. (Hard to say whilst in mid-process.)
I'm sorry for the confusion. I should have given better indications as to my intentions for this :/ I hope you can forgive me.
| Assignee | ||
Comment 6•14 years ago
|
||
Cool, I was just thinking like C, I need to think with tuples more in Python. Let me know when the patch goes up.
| Reporter | ||
Comment 7•14 years ago
|
||
This is mostly done with bug 704654. There are some things left to extract but they should probably be filed separately
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•