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: ignore cython files #33560

Closed
tobiasdiez opened this issue Mar 25, 2022 · 16 comments
Closed

pytest: ignore cython files #33560

tobiasdiez opened this issue Mar 25, 2022 · 16 comments

Comments

@tobiasdiez
Copy link
Contributor

As we probably don't want people to write pytests in Cython, we should skip collecting cython files to prevent issues like

$ ./sage -t src/sage/symbolic/expression.pyx
[...]

============================================================================================================ test session starts ============================================================================================================
platform darwin -- Python 3.10.2, pytest-7.0.1, pluggy-1.0.0
rootdir: /Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/src, configfile: tox.ini
collected 0 items                                                                                                                                                                                                                           

=========================================================================================================== no tests ran in 0.01s ===========================================================================================================
ERROR: not found: /Users/mkoeppe/s/sage/sage-rebasing/worktree-gcc11/src/sage/symbolic/expression.pyx

Later, one could use https://github.com/lgpage/pytest-cython to extract doctests from cython files.

Depends on #33572

CC: @mkoeppe

Component: doctest framework

Author: Tobias Diez

Branch/Commit: 4c0ff54

Reviewer: Matthias Koeppe

Issue created by migration from https://trac.sagemath.org/ticket/33560

@tobiasdiez
Copy link
Contributor Author

Branch: public/tests/pytest_no_cython

@tobiasdiez
Copy link
Contributor Author

Commit: 3d5179a

@tobiasdiez
Copy link
Contributor Author

New commits:

3d5179apytest: Ignore cython files

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 25, 2022

comment:2

Merge conflict with #33549

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 29, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

cce0285Merge remote-tracking branch 'origin/develop' into public/tests/pytest_no_cython

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 29, 2022

Changed commit from 3d5179a to cce0285

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 30, 2022

Dependencies: #33572

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 30, 2022

Changed commit from cce0285 to feffc30

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 30, 2022

Branch pushed to git repo; I updated commit sha1. New commits:

1ab83b2src/bin/sage: Implement 'sage --pytest'
9036ca8src/conftest.py: import sage.all to avoid cyclic import errors
3c09949src/conftest.py: Add # type: ignore, add reference to trac ticket
07b5852src/conftest.py: Remove outdated text
f53bbc7src/bin/sage: Handle 'sage -pytest' without file args
11219e5src/tox.ini (pytest): Set --import-mode importlib here, not in src/bin/sage, src/bin/sage-runtests
feffc30Merge #33572

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 30, 2022

comment:6

I've merged #33572 to resolve a merge conflict and tested with ./sage -pytest src/sage/symbolic/expression.pyx.

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 30, 2022

Reviewer: Matthias Koeppe

@tobiasdiez
Copy link
Contributor Author

comment:7

Thanks!

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 30, 2022

Branch pushed to git repo; I updated commit sha1 and set ticket back to needs_review. This was a forced push. New commits:

f0d5f84src/conftest.py: import sage.all to avoid cyclic import errors
d881a5asrc/conftest.py: Add # type: ignore, add reference to trac ticket
1242e1fsrc/conftest.py: Remove outdated text
0d9225dsrc/bin/sage: Handle 'sage -pytest' without file args
05bc58fsrc/tox.ini (pytest): Set --import-mode importlib here, not in src/bin/sage, src/bin/sage-runtests
4c0ff54Merge #33572

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Mar 30, 2022

Changed commit from feffc30 to 4c0ff54

@mkoeppe
Copy link
Contributor

mkoeppe commented Mar 30, 2022

comment:9

Redid the merge with #33572

@vbraun
Copy link
Member

vbraun commented Apr 3, 2022

Changed branch from public/tests/pytest_no_cython to 4c0ff54

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

No branches or pull requests

3 participants