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

Unable to run tests #913

Open
ronikobrosly opened this issue Aug 25, 2024 · 2 comments
Open

Unable to run tests #913

ronikobrosly opened this issue Aug 25, 2024 · 2 comments

Comments

@ronikobrosly
Copy link

Hi, I'm working on a PR but first I'd like to make sure I can get all tests running. I followed all of the instructions in the For Developers, Pre-commit hooks, and Running the tests section of the README. When I run the command python setup.py pytest I get the following:

(econml) C:\Users\ronik\Desktop\EconML>python setup.py pytest
C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\ptr\__init__.py:81: SetuptoolsDeprecationWarning: The test command is disabled and references to it are deprecated.
!!

        ********************************************************************************
        Please remove any references to `setuptools.command.test` in all supported versions of the affected package.

        By 2024-Nov-15, you need to update your project and remove deprecated calls
        or your builds will no longer be supported.
        ********************************************************************************

!!
  class PyTest(orig.test):
running pytest
Traceback (most recent call last):
  File "setup.py", line 34, in <module>
    setup(ext_modules=c_extensions + pyx_extensions,
  File "C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\setuptools\__init__.py", line 111, in setup
    return distutils.core.setup(**attrs)
  File "C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\setuptools\_distutils\core.py", line 184, in setup
    return run_commands(dist)
  File "C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\setuptools\_distutils\core.py", line 200, in run_commands
    dist.run_commands()
  File "C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\setuptools\_distutils\dist.py", line 964, in run_commands
    self.run_command(cmd)
  File "C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\setuptools\dist.py", line 948, in run_command
    super().run_command(command)
  File "C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\setuptools\_distutils\dist.py", line 983, in run_command
    cmd_obj.run()
  File "C:\Users\ronik\anaconda3\envs\econml\lib\site-packages\ptr\__init__.py", line 195, in run
    setattr(dist, attr, getattr(self.distribution, attr))
AttributeError: 'Distribution' object has no attribute 'tests_require'

This is with python 3.8.x. Any suggestions?

@kbattocchi
Copy link
Collaborator

Oops, that documentation is out of date - it should say python -m pytest rather than python setup.py pytest, I'll update it.

Even with that change, it's likely that you'll need some extra dependencies for tests - I think pip install pytest pytest-xdist pytest-cov coverage[toml] will get all of the test runner dependencies, and you'll also need to run pip install jupyter jupyter-client nbconvert nbformat seaborn xgboost tqdm if you want to run the notebook tests. (You'll also need to have installed the [all] extra for econml, or else you'll might be missing some package dependencies like tensorflow that are needed only by a smaller subset of our API).

However, as mentioned in that section of the README, it usually does not make sense to run all of the tests, so I'd default to using unittest to just run the tests for the code that you're working on (but thanks for the bug report, we shouldn't have misleading directions in the README).

@ronikobrosly
Copy link
Author

Okay thanks for the heads up @kbattocchi !

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

No branches or pull requests

2 participants