Skip to content

TST: add test demonstrating the ndebug issue #379

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

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 15 additions & 0 deletions tests/test_default_options.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import os
import subprocess

import pytest

import mesonpy


@pytest.mark.parametrize('args', [[], ['-Dbuildtype=release']], ids=['defaults', '-Dbuildtype=release'])
def test_ndebug(package_scipy_like, tmp_path, args):
with mesonpy._project({'setup-args': args}) as project:
command = subprocess.run(
['ninja', '-C', os.fspath(project._build_dir), '-t', 'commands', '../../mypkg/extmod.c^'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ^ is a typo I think?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ^ asks ninja to report the build command for the target having the file preceding the ^ as part of its inputs. See the second paragraph here https://ninja-build.org/manual.html#_running_ninja

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah interesting, didn't know that.

stdout=subprocess.PIPE, check=True).stdout
assert b'-DNDEBUG' in command