allankp / pytest-testrail

pytest plugin for integration with TestRail, for creating testruns and updating results
MIT License
96 stars 124 forks source link

Allow config options to be specified either by flag or via cfg file #24

Closed samdfonseca closed 7 years ago

samdfonseca commented 7 years ago

This PR mainly allows anything that could be set in the config file to be set through command line flags. I prefer not to have login credentials written to a file anywhere so this helps me avoid that. Each command line flag, except for --testrail and --tr-config, can also be set in the config file, but command line flags override config file values.

I also added the pytestrail class which has a static method case that's equivalent to the testrail function in the plugin module. I noticed that py.test was collecting testrail as a test (presumably because of the 'test' prefix, although the py.test documentation says it looks for a 'test_' prefix), and this fix worked nicely.

samdfonseca commented 7 years ago

@dubner thoughts?

allankp commented 7 years ago

@samdfonseca added some comments, really minor. Nice work. Thanks for the fix to the test_ / test prefix

samdfonseca commented 7 years ago

@dubner, thanks for the feedback. I haven't had a chance to respond yet but I should be able to do that within the next couple of days.

samdfonseca commented 7 years ago

@dubner sorry for not getting back to you sooner on this. i've push a couple additional changes to address your feedback as well as a couple tweaks to get rid of some warnings i was seeing.

====================================================================================================================== warnings summary =======================================================================================================================
None
  pytest_funcarg__cov: declaring fixtures using "pytest_funcarg__" prefix is deprecated and scheduled to be removed in pytest 4.0.  Please remove the prefix and use the @pytest.fixture decorator instead.

tests/test_plugin.py::TestRailPlugin
  cannot collect test class 'TestRailPlugin' because it has a __init__ constructor

-- Docs: http://doc.pytest.org/en/latest/warnings.html

updating the version of pytest-cov in the requirements/testing.txt file got rid of the first warning. to get rid of the second one, i changed the plugin class name to PyTestRailPlugin since pytest collects classes that match 'Test*' as test classes.

chartjes commented 7 years ago

Hello folks. Over at Mozilla Firefox Test Engineering we are happy users of this plugin and this PR would fix a problem we're running into involving reporting test runs made by pytest inside a Docker container since we don't want to commit the user/API key combo into a file anywhere.

I'd prefer to not fork and use my own branch and merge this PR in. Any chance this is getting merged in any time soon?

allankp commented 7 years ago

@samdfonseca Thanks for your contribution