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

MAINT: Fix sneaky typo [f2py] #25185

Merged
merged 2 commits into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions numpy/f2py/f2py2e.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ def run_compile():
# Collect dependency flags, preprocess sys.argv
argy = preparse_sysargv()
modulename = argy["modulename"]
if modulename is None:
modulename = 'untitled'
dependencies = argy["dependencies"]
backend_key = argy["backend"]
build_backend = f2py_build_generator(backend_key)
Expand Down
15 changes: 15 additions & 0 deletions numpy/f2py/tests/test_f2py2e.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import textwrap, re, sys, subprocess, shlex
from pathlib import Path
from collections import namedtuple
import platform

import pytest

Expand Down Expand Up @@ -197,6 +198,20 @@ def test_gen_pyf_no_overwrite(capfd, hello_world_f90, monkeypatch):
assert "Use --overwrite-signature to overwrite" in err


@pytest.mark.skipif((platform.system() != 'Linux') and (sys.version_info <= (3, 12)), reason='Compiler and 3.12 required')
def test_untitled_cli(capfd, hello_world_f90, monkeypatch):
"""Check that modules are named correctly

CLI :: defaults
"""
ipath = Path(hello_world_f90)
monkeypatch.setattr(sys, "argv", f"f2py --backend meson -c {ipath}".split())
with util.switchdir(ipath.parent):
f2pycli()
out, _ = capfd.readouterr()
assert "untitledmodule.c" in out


@pytest.mark.xfail
def test_f2py_skip(capfd, retreal_f77, monkeypatch):
"""Tests that functions can be skipped
Expand Down
Loading