Skip to content
This repository was archived by the owner on Aug 11, 2023. It is now read-only.
This repository was archived by the owner on Aug 11, 2023. It is now read-only.

unknown configuration value: u'config_dir' #175

Closed

Description

@yeganer

When updating to astropy v1.1 or greater I get the following error with tardis.

ValueError: unknown configuration value: u'config_dir'

Tardis is built upon the package_template. I tried several things to solve this issue but the only thing that worked was redefining pytest_runtest_setup which I think is not the best solution. Any idea what we may be causing this? Were there major changes in the package template that need to be propagated? Is there a recommended way of keeping the template files up to date with astropy/package-template?

Thanks for helping in advance.

EDIT: updated link

Activity

  1. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    @pllim Sorry I updated the link. I guess we are using the new configuration system. We are using astropy 1.0.4 in 'production'. When updating to astropy 1.1 we stumbled upon this error.
    The line with the error is:

    astropy/tests/pytest_plugins.py:458
    config_dir = item.config.getini('config_dir')
    
  2. pllim commented on Jun 3, 2016

    @pllim
    Member

    The tracebacks point to astropy/tests/pytest_plugins.py, which is not really in the template, but rather in Astropy core itself. Also, how exactly are you running your tests, i.e., what command do you use?

  3. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    I'm using ./setup.py test.

  4. pllim commented on Jun 3, 2016

    @pllim
    Member

    My hunch is that your conftest.py is messed up. In your file, you re-defined def pytest_*() functions.

  5. pllim commented on Jun 3, 2016

    @pllim
    Member

    Compare yours with the one in the template, and you can see the difference.

  6. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    I thought the same but deleting everything pytest_ related didn't solve the issue.

  7. pllim commented on Jun 3, 2016

    @pllim
    Member

    What version is your pytest? Maybe try update to the latest Astropy and astropy-helpers if you still see problem?

  8. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    I think I found the 'bug'. redefining pytest_addoption is a bad idea because there the ini option is defined.
    What's the recommended way to add pytest optinons?

  9. pllim commented on Jun 3, 2016

    @pllim
    Member

    What options do you need that is not already available?

  10. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    We add two options for running extended tests. Without these options a quick test run is preformed. Adding the option enables something like integration tests.

    EDIT:
    Here is the option in question:
    https://github.com/tardis-sn/tardis/blob/master/tardis/conftest.py#L52

  11. pllim commented on Jun 3, 2016

    @pllim
    Member

    Hmm, not sure about redefining pytest_addoption itself. Maybe someone else can comment on that.

    Personally, I have used the @remote_data decorator on my tests to mark it as "extended", which means they won't run unless I give the --remote-data option. Kinda hacky for your case but might be a temporary workaround until someone can suggest something better.

  12. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    I actually suggested using @remote_data to replace --atomic-dataset but with the currently WIP implementation of full integration tests which need a specific config file I don't think that works.

    A workaround would be to hardcode the path to the integration_test_config and if it's missing skip the tests. But that would be hacky.

    Thank you very much for the help so far. I'll discuss this issue with the rest of the collaboration.

  13. pllim commented on Jun 3, 2016

    @pllim
    Member

    Another option, maybe, is to move all those tests to a different sub-package. Then you can instruct your test runner to run everything but the tests in the sub-package using -P option. Something to think about.

  14. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    -P only runs tests inside a specific module/package? What's the difference to --test-path?

  15. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    Another option would be to 'fix' this in astropy by providing something like PYTEST_HEADER_MODULES for ini and config options.

  16. pllim commented on Jun 3, 2016

    @pllim
    Member

    -P only runs tests inside a specific module/package?

    Yes.

    You can certainly bring this up as an issue, but that would be at https://github.com/astropy/astropy/issues

  17. yeganer commented on Jun 3, 2016

    @yeganer
    Author

    Sure, I just asked on gitter how they feel about it. If it's worth doing I'd make an issue and if I have the time and it works the way I currently think about it, I'll make a PR.

  18. yeganer commented on Jun 5, 2016

    @yeganer
    Author

    Thanks for the help. I ended up doing the following:

    from astropy.tests.pytest_plugins import pytest_addoption as _pytest_addoption
    
    def pytest_addoption(parser):
        _pytest_addoption(parser)
        parser.addconfig(...)
    
  19. pllim commented on Jun 6, 2016

    @pllim
    Member

    Great it works out for you. Feel free to close this issue if you think it is no longer a problem.

  20. yeganer commented on Jun 7, 2016

    @yeganer
    Author

    Sorry, totally forgot to close it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions