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

pytest error in pytest.ini #7455

Closed
ahmedhosssam opened this issue Feb 26, 2024 · 5 comments
Closed

pytest error in pytest.ini #7455

ahmedhosssam opened this issue Feb 26, 2024 · 5 comments
Labels
Infrastructure Issues or PRs that affect the CI or packaging of SunPy Question For issues that are questions.

Comments

@ahmedhosssam
Copy link
Contributor

ahmedhosssam commented Feb 26, 2024

I am a new contributor here (coming from GSOC), I followed the newcomers guide till the end, and I reached this error when I ran pytest command:

ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: --dist inifile: /home/ahmed/fun/sunpy/pytest.ini rootdir: /home/ahmed/fun/sunpy

I think the problem is in the pytest.ini file, typically in addopts variable. If I commented addopts pytest runs but it gives me more than a hundred errors (missing packages) so I don't know what to do right now.

@nabobalis
Copy link
Contributor

Hello @ahmedhosssam,

Can you tell me how you installed the test dependencies within your virtual environment?

Our test suite requires pytest and several other plugins which should be installed if you do pip install -e . [tests]

If it does not work, there is a bug in either our package configuration or the newcomers guide.

@nabobalis nabobalis added Infrastructure Issues or PRs that affect the CI or packaging of SunPy Question For issues that are questions. labels Feb 26, 2024
@ahmedhosssam
Copy link
Contributor Author

Yes, now it works after pip install -e .[tests].
It exists in one of the newcomers guide's links but it doesn't exist in the page itself.
I think if we added at least this command in the newcomers guide it will be fine.

Instead of:
$ git clone https://github.com/<username>/sunpy.git sunpy-git
$ cd sunpy-git
$ git remote add upstream https://github.com/sunpy/sunpy.git
$ git fetch --tags upstream
$ pip install -e ".[dev]"

It will be:
$ git clone https://github.com/<username>/sunpy.git sunpy-git
$ cd sunpy-git
$ git remote add upstream https://github.com/sunpy/sunpy.git
$ git fetch --tags upstream
$ pip install -e ".[dev]"
$ pip install -e ".[tests]"

I don't know if this is right or not, but I think the tests packages are as important as the dev packages.

@nabobalis
Copy link
Contributor

In theory ".[dev]" should install all of tests.

I will need to check.

@nabobalis
Copy link
Contributor

At least for me, when I run it, it checks for pytest and all of the other test dependencies.

I am not sure how to explain why it didn't work for you.

@ahmedhosssam
Copy link
Contributor Author

Maybe I did something wrong when I was setting up the virtual environment, I don't know.
But now it works, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Infrastructure Issues or PRs that affect the CI or packaging of SunPy Question For issues that are questions.
Projects
None yet
Development

No branches or pull requests

2 participants