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

Config cleanup #3

Merged
merged 14 commits into from
Dec 1, 2016
Merged

Config cleanup #3

merged 14 commits into from
Dec 1, 2016

Conversation

mbukatov
Copy link
Contributor

This a proposed cleanup of test configuration. Documentation with an explanation is provided.

@mbukatov
Copy link
Contributor Author

This request is based on our discussion from yesterday. @mkudlej @ltrilety @fbalak : Could you review this pull request (github review feature is available in Files changed tab)?

Copy link
Contributor

@ltrilety ltrilety left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to see options for host and usm config file as special options for pytest. I am planning to make the commit morrow.

@mbukatov
Copy link
Contributor Author

The more I think about the current design, I feel that the current design is not good:

  • we are polluting pytest config namespace
  • we would have to change code of config module for every group
  • we would need to document how to translate usm.ini name into pytest.ini name

I would rather do this:

  • have global config module (eg. usmqe.config) which would be populated during pytest start (in the same way as usmqe.inventory module works right now)

@mbukatov
Copy link
Contributor Author

We have decided to stay with extending pytest config module, but simplify the process significantly. I'm going to publish an update of this pull request today.

Only 2 most important options which can't be reconfigured in usmqe ini
file remain listed here in plugin/usmqe_config.py
@mbukatov
Copy link
Contributor Author

I need to test the changes before we can go on, but you can already comment/do a review. @mkudlej

@mbukatov
Copy link
Contributor Author

I tested the change proposed in this pull request with this simple enviroment (not using mrglog and usmqe assume on purpose) and simple positive scenario works as expected:

$ cat conf/usm.ini 
[usmqepytest]
usm_username = admin
$ cat usmqe_tests/config_cleanup.py
import pytest

def test_config_admin():
    assert pytest.config.getini("usm_username") == "admin"
$ py.test -v usmqe_tests/config_cleanup.py
================================================= test session starts ==================================================
platform linux -- Python 3.5.1, pytest-3.0.4, py-1.4.31, pluggy-0.4.0 -- /opt/rh/rh-python35/root/usr/bin/python3
cachedir: .cache
rootdir: /home/usmqe/usmqe-tests, inifile: pytest.ini
collected 1 items 

usmqe_tests/config_cleanup.py::test_config_admin PASSED

=============================================== 1 passed in 0.01 seconds ==============================================

That said, it fails when I tried to specify the value of the option via command line:

$ py.test -v -o usm_username=foo usmqe_tests/config_cleanup.py
Traceback (most recent call last):
  File "/home/usmqe/.local/lib/python3.5/site-packages/_pytest/config.py", line 1064, in getini
    return self._inicache[name]
KeyError: 'testpaths'

So I need to fix this first.

@mbukatov
Copy link
Contributor Author

Hmm, it seems to be a py.test issue after all, as I'm able to reproduce this problem in clean setup without any usmqe code: pytest-dev/pytest#2105

@mbukatov mbukatov dismissed ltrilety’s stale review November 30, 2016 18:20

On 2016-11-29 we (@mkudlej, @mbukatov, @ltrilety) decided to stay with the ini config options for host and usm config file for now.

@mbukatov
Copy link
Contributor Author

mbukatov commented Dec 1, 2016

I just clarified how the override ini feature should be used based on the discussion under the pytest issue. Everything seems to work fine.


We assume that:

* *QE Server mahcine* has been configured as described in
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: "mahcine"

@mbukatov mbukatov merged commit 2fc320e into master Dec 1, 2016
@mbukatov mbukatov deleted the config_cleanup branch December 1, 2016 09:19
quarckster pushed a commit to quarckster/usmqe-tests that referenced this pull request Oct 24, 2018
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.

3 participants