Skip to content

pytest needed as (runtime) requirement? #6787

Description

@maartenbreddels

pytest is now listed as install_requires in setup.py, and also included as 'run requirement' in the conda recipe. I think it's better to use tests_require (see http://setuptools.readthedocs.io/en/latest/setuptools.html) for setup.py, and not include it in the recipe. In general I don't think test packages should be dependencies, people that want to test will either have this in their environment already, or will read the documentation.

Activity

  1. astrofrog commented on Oct 25, 2017

    @astrofrog
    Member

    We'll be removing this dependency shortly - cc @drdavella

  2. bsipocz commented on Oct 25, 2017

    @bsipocz
    Member

    Well, we also need it for the Testrunner class, and I vaguely remember that we had issues with the recipe/building the conda package when it didn't include it in the run requirements: https://travis-ci.org/conda-forge/astropy-feedstock/jobs/251188788

  3. drdavella commented on Oct 25, 2017

    @drdavella
    Contributor

    Due to the way the test runner currently works, tests_require is not a workable solution. However, as @astrofrog mentioned, pytest has been removed from install_requires in #6606. With this PR, astropy now uses a testing metapackage called pytest-astropy, and this package is listed in extras_require.

    With respect to the conda recipe, it will likely be necessary to keep pytest as a "run requirement" due to the design of the astropy test runner. I hope to address this in future work so that this will no longer be necessary.

  4. maartenbreddels commented on Oct 25, 2017

    @maartenbreddels
    Author

    Ok great, that PR answers the setup.py question.

    I think unless you have reasons to do otherwise, testing on conda-forge doesn't need to be this thorough. It's generally assume that when released, testing has already passed, but you can do light sanity check, such as importing is enough.
    If you insist testing, you could also do a os.system('conda install -y pytest') in the run_test.py to avoid having a run requirement.

  5. mwcraig commented on Oct 25, 2017

    @mwcraig
    Member

    Well, we also need it for the Testrunner class, and I vaguely remember that we had issues with the recipe/building the conda package when it didn't include it in the run requirements: https://travis-ci.org/conda-forge/astropy-feedstock/jobs/251188788

    That should be fixable in the conda recipe, which has a separate section for test requirements (that actually works as opposed to tests_require in setup.py).

  6. bsipocz commented on Oct 25, 2017

    @bsipocz
    Member

    @maartenbreddels @mwcraig - I'm happy to hear about these option, we should then definitely switch to use either of those.

  7. drdavella commented on Oct 25, 2017

    @drdavella
    Contributor

    @mwcraig, @bsipocz if you're willing to wait until #6606 is merged, then we can simply add pytest-astropy to the conda recipe test requirements.

  8. bsipocz commented on Oct 25, 2017

    @bsipocz
    Member

    @drdavella - I don't see this as a reason for us to make a new conda-forge build, especially as we advertise the default channel as the main source of astropy on conda. So, yes, that would be great to have for the 3.0 release.

  9. dstansby commented on May 6, 2019

    @dstansby
    Contributor

    Any news on this/anything I can do to help? Installing in conda gives the below, and I find it really odd that as a user I should be expected to install a testing library:

    The following NEW packages will be INSTALLED:
    
      astropy            pkgs/main/osx-64::astropy-3.1.2-py37h1de35cc_0
      atomicwrites       pkgs/main/osx-64::atomicwrites-1.3.0-py37_1
      more-itertools     pkgs/main/osx-64::more-itertools-7.0.0-py37_0
      pluggy             pkgs/main/osx-64::pluggy-0.9.0-py37_0
      psutil             pkgs/main/osx-64::psutil-5.6.2-py37h1de35cc_0
      py                 pkgs/main/osx-64::py-1.8.0-py37_0
      pytest             pkgs/main/osx-64::pytest-4.4.1-py37_0
      pytest-arraydiff   pkgs/main/osx-64::pytest-arraydiff-0.3-py37h39e3cac_0
      pytest-astropy     pkgs/main/osx-64::pytest-astropy-0.5.0-py37_0
      pytest-doctestplus pkgs/main/osx-64::pytest-doctestplus-0.3.0-py37_0
      pytest-openfiles   pkgs/main/osx-64::pytest-openfiles-0.3.2-py37_0
      pytest-remotedata  pkgs/main/osx-64::pytest-remotedata-0.3.1-py37_0
    
  10. dstansby commented on Dec 3, 2019

    @dstansby
    Contributor

    Bump on this - happy to help, but I'm not sure what needs doing to remove the pytest dependency.

  11. pllim commented on May 11, 2020

    @pllim
    Member

    I don't think this is a problem anymore?

  12. added
    Close?Tell stale bot that this issue/PR is stale
    on May 11, 2020
  13. dstansby commented on May 11, 2020

    @dstansby
    Contributor

    I'm not sure this ever got merged into https://github.com/AnacondaRecipes/astropy-feedstock, but did get merged into the conda-forge stock. If I do conda install astropy in a clean environment I get the below, which still includes pytest-astropy:

      astropy            pkgs/main/osx-64::astropy-4.0.1.post1-py38h1de35cc_0
      attrs              pkgs/main/noarch::attrs-19.3.0-py_0
      blas               pkgs/main/osx-64::blas-1.0-mkl
      ca-certificates    pkgs/main/osx-64::ca-certificates-2020.1.1-0
      certifi            pkgs/main/osx-64::certifi-2020.4.5.1-py38_0
      hypothesis         pkgs/main/noarch::hypothesis-5.11.0-py_0
      intel-openmp       pkgs/main/osx-64::intel-openmp-2020.1-216
      libcxx             pkgs/main/osx-64::libcxx-4.0.1-hcfea43d_1
      libcxxabi          pkgs/main/osx-64::libcxxabi-4.0.1-hcfea43d_1
      libedit            pkgs/main/osx-64::libedit-3.1.20181209-hb402a30_0
      libffi             pkgs/main/osx-64::libffi-3.3-h0a44026_1
      libgfortran        pkgs/main/osx-64::libgfortran-3.0.1-h93005f0_2
      mkl                pkgs/main/osx-64::mkl-2019.4-233
      mkl-service        pkgs/main/osx-64::mkl-service-2.3.0-py38hfbe908c_0
      mkl_fft            pkgs/main/osx-64::mkl_fft-1.0.15-py38h5e564d8_0
      mkl_random         pkgs/main/osx-64::mkl_random-1.1.0-py38h6440ff4_0
      more-itertools     pkgs/main/noarch::more-itertools-8.2.0-py_0
      ncurses            pkgs/main/osx-64::ncurses-6.2-h0a44026_1
      numpy              pkgs/main/osx-64::numpy-1.18.1-py38h7241aed_0
      numpy-base         pkgs/main/osx-64::numpy-base-1.18.1-py38h6575580_1
      openssl            pkgs/main/osx-64::openssl-1.1.1g-h1de35cc_0
      packaging          pkgs/main/noarch::packaging-20.3-py_0
      pip                pkgs/main/osx-64::pip-20.0.2-py38_3
      pluggy             pkgs/main/osx-64::pluggy-0.13.1-py38_0
      psutil             pkgs/main/osx-64::psutil-5.7.0-py38h1de35cc_0
      py                 pkgs/main/noarch::py-1.8.1-py_0
      pyparsing          pkgs/main/noarch::pyparsing-2.4.7-py_0
      pytest             pkgs/main/osx-64::pytest-5.4.1-py38_0
      pytest-arraydiff   pkgs/main/osx-64::pytest-arraydiff-0.2-py38h39e3cac_0
      pytest-astropy     pkgs/main/noarch::pytest-astropy-0.8.0-py_0
      pytest-astropy-he~ pkgs/main/noarch::pytest-astropy-header-0.1.2-py_0
      pytest-doctestplus pkgs/main/noarch::pytest-doctestplus-0.5.0-py_0
      pytest-openfiles   pkgs/main/noarch::pytest-openfiles-0.5.0-py_0
      pytest-remotedata  pkgs/main/osx-64::pytest-remotedata-0.3.2-py38_0
      python             pkgs/main/osx-64::python-3.8.2-hf48f09d_13
      readline           pkgs/main/osx-64::readline-8.0-h1de35cc_0
      setuptools         pkgs/main/osx-64::setuptools-46.2.0-py38_0
      six                pkgs/main/osx-64::six-1.14.0-py38_0
      sortedcontainers   pkgs/main/osx-64::sortedcontainers-2.1.0-py38_0
      sqlite             pkgs/main/osx-64::sqlite-3.31.1-h5c1f38d_1
      tk                 pkgs/main/osx-64::tk-8.6.8-ha441bb4_0
      wcwidth            pkgs/main/noarch::wcwidth-0.1.9-py_0
      wheel              pkgs/main/osx-64::wheel-0.34.2-py38_0
      xz                 pkgs/main/osx-64::xz-5.2.5-h1de35cc_0
      zlib               pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3
    
  14. added and removed
    Close?Tell stale bot that this issue/PR is stale
    on May 11, 2020
  15. pllim commented on May 11, 2020

    @pllim
    Member

    Oh, okay. Thanks for the clarification!

  16. pllim commented on May 12, 2020

    @pllim
    Member

    @dstansby , looks like Anaconda fixed the recipe. Maybe give it a few days to make it into the defaults channel and try again?

  17. astropy-bot commented on May 20, 2020

    @astropy-bot

    Hi humans 👋 - this issue was labeled as Close? approximately 7 days ago. If you think this issue should not be closed, a maintainer should remove the Close? label - otherwise, I will close this issue in a month.

    If you believe I commented on this issue incorrectly, please report this here

  18. astropy-bot commented on Jun 22, 2020

    @astropy-bot

    I'm going to close this issue as per my previous message, but if you feel that this issue should stay open, then feel free to re-open and remove the Close? label.

    If this is the first time I am commenting on this issue, or if you believe I closed this issue incorrectly, please report this here

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions