summaryrefslogtreecommitdiff
path: root/run_unittests.py
AgeCommit message (Collapse)Author
2025-07-22unittests: allow running with pytest/unittest directlyChristoph Reiter
Currently the unittests are not runnable with pytest or unittest without going through the run_unittests.py wrapper, or setting certain env vars like MESON_UNIT_TEST_BACKEND. This has that downside that the common "pytest ..." fails and integration with things like VSCode fails too. To work around that we set everything that is needed to run the tests in __init__.py and run_unittests is only one more variant to invoke them by providing different defaults and settings. To make sure that pytest/unittest discover and run_unittests don't diverge implement an automatic test discovery in run_unittests to avoid hardcoding the tests to run there. There shouldn't be any functional changes.
2024-06-14cargo: Load Cargo.lockXavier Claessens
Cargo.lock is essentially identical to subprojects/*.wrap files. When a (sub)project has a Cargo.lock file this allows automatic fallback for its cargo dependencies.
2023-12-13Use SPDX-License-Identifier consistentlyDylan Baker
This replaces all of the Apache blurbs at the start of each file with an `# SPDX-License-Identifier: Apache-2.0` string. It also fixes existing uses to be consistent in capitalization, and to be placed above any copyright notices. This removes nearly 3000 lines of boilerplate from the project (only python files), which no developer cares to look at. SPDX is in common use, particularly in the Linux kernel, and is the recommended format for Meson's own `project(license: )` field
2023-08-18tests: fix assertion rewriting when pytest is usedBenoit Pierre
2023-06-07cargo/cfg: Add a parser for the rust/cargo cfg() expressionsDylan Baker
This uses a recursive descent parser + lexer to create an IR from cfg() expressions, which it then converts into meson IR.
2023-06-07cargo/version: add a function to convert cargo versioning to mesonDylan Baker
2022-02-14run_unittests: check for pytest and pytest-xdist separatelyEli Schwartz
Do not quit from using pytest at all, when pytest is present, simply because xdist isn't available. Even without xdist, pytest is still useful. There doesn't seem to be any particular reason to require xdist. It just happens to have been implemented that way, back in commit 4200afc74d1e6ba6d117e900799d0d82a85bae8a when we originally added a check to avoid pytest erroring out with unknown options when xdist options are passed and xdist is not installed.
2021-10-26remove unused importsEli Schwartz
2021-10-10Add --vsenv command line option and active VS only when neededXavier Claessens
2021-09-21Add platform agnostic testsXavier Claessens
This adds a new category of tests that does not need to run on all platforms during CI. For now only run them on Linux runners because they are not the bottleneck.
2021-07-26Split run_unittests.py fileXavier Claessens
2021-07-26coredata: throw a MesonException on unknown optionsFlorian Schmaus
Fixes #7288.
2021-07-25ast: Add dummy "support" for fstrings in the ast packageDaniel Mensinger
2021-07-22Merge pull request #8992 from dcbaker/submit/modernize-python-module-dependencyJussi Pakkanen
Cleanup the python module
2021-07-18Merge pull request #8972 from bonzini/C-symlinkJussi Pakkanen
resolve symlinks passed to -C
2021-07-15Condense test directory names for next release.Jussi Pakkanen
2021-07-13modules/pkgconfig: remove handling of .pcdepDylan Baker
Nothing uses this anymore, so don't check for it.
2021-07-13run_unittests: add test for passing symlinks to setup and testPaolo Bonzini
2021-07-03Delete redirected wrap files in subprojects purgeTristan Partin
We need to store the original filename as well as whether the wrap was redirected in order to properly purge the redirected wrap.
2021-07-02Flatten test suite valueTristan Partin
This behavior is more inline with the rest of Meson
2021-06-29fix: Always explicitly set encoding for text files (fixes #8263)Daniel Mensinger
2021-06-29pathlib: Patch pathlib to work around some bugs (fixes #7295)Daniel Mensinger
2021-06-25Split compiler detection from EnvironmentDaniel Mensinger
This moves all the compiler detection logic into the new compilers.detect module. This dramatically reduces the size and complexity of Environment.
2021-06-23Merge pull request #8884 from dcbaker/submit/type-and-annotate-install-functionsJussi Pakkanen
Add annotations for the various install_* functions
2021-06-22coverage: Enable coverage reportsDaniel Mensinger
2021-06-22interpreterbase: Add evolve to KwargInfoDylan Baker
This works just like OptionKey.evolve, pass new keyword arguments to override old ones, otherwise the original versions are copied to the new one.
2021-06-18holders: remove unholderDaniel Mensinger
2021-06-18holders: Introduce HoldableObjectDaniel Mensinger
2021-06-18tests: Always enable the traceback in run_project_tests.pyDaniel Mensinger
2021-06-17doc: Add missing modules to dropdown listXavier Claessens
2021-06-16interpreter: Extract dependency() logic into its own helper classXavier Claessens
The dependency lookup is a lot of complex code. This refactor it all into a single file/class outside of interpreter main class. This new design allows adding more fallbacks candidates in the future (e.g. using cc.find_library()) but does not yet add any extra API.
2021-06-15docs: Use an include for the qt modulesDylan Baker
Insteadf of qt4 referencing the Qt5 page, include the same content in both.
2021-06-14interpreterbase: Add deprecated_values and since_values to KwargInfoDylan Baker
This allows checking specific values that are added or deprecated, which we do a surprising amount of. This works with both containers and scalar values
2021-06-14run_unittests: mock meson global before changingDylan Baker
For safety
2021-06-09tests: Force colorize CI outputDaniel Mensinger
2021-06-08Merge pull request #8512 from bonzini/feature-methodsJussi Pakkanen
Utility methods for feature objects
2021-06-08intperperterbase: Add a convertor keyword argumentDylan Baker
This is meant to allow simple type conversions to happen before the interpreter function is called. This should simplify some cases like the "native" keyword arugment that are booleans in the Meson DSL, but an Enum in the implementation
2021-06-08interpreterbase: Add validator keyword argument to typed_kwargsDylan Baker
This attribute is a callable that returns a string if the value is invalid, otherwise None. This intended for cases like the `install_*` function's `install_mode` paramater, which is either an int or the string "preserve", which allows us to do nice things like: ```python class Kwargs(TypedDict): install_mode: T.Union[int, T.Literal['preserve']] @typed_kwargs( 'foo', KwargInfo('install_mode', ..., validator=lambda x: None if isinstance(x, int) or x == 'preserve' else 'must be the literal "preserve"), ) def install_data(self, node, args, kwargs: 'Kwargs'): ... ``` In this case mypy *knows* that the string is preserve, as do we, and we can simply do tests like: ```python if kwargs['install_mode'] == 'preserve': ... else: # this is an int ```
2021-06-08run_unittests.py: Use mock for monkey patchingDylan Baker
it's what mock is for afterall
2021-06-08run_unittests.sh: fix Python DeprecationWarningPaolo Bonzini
Fix the following Python error: D:\a\1\s\run_unittests.py:6654: DeprecationWarning: invalid escape sequence \ self.assertEqual(libhello_nolib.get_pkgconfig_variable(escaped_var, {}), hello world) Use a raw string literal.
2021-06-04interpreterbase: Allow safely using mutable default values with typed_kwargsDylan Baker
It's really inconvenient to want a thing that is always a list, but not be able to provide a default value of a list because of mutation. To that end the typed_kwargs method now makes a shallow copy of the default when using a `ContainerTypeInfo` as the type. This mean that using a default of `[]` is perfectly safe.
2021-06-03deps: Split dependencies.baseDaniel Mensinger
Split the Factory and dependency classes out of the base.py script to improve maintainability.
2021-06-01typed_kwargs: Add since and deprecated annotationsXavier Claessens
2021-05-30interpreterbase: Add a function for type checking keyword argumentsDylan Baker
2021-05-23Fix text used to validate test output.Jussi Pakkanen
2021-05-23Merge pull request #8786 from jon-turney/cygwin-tests-reenableJussi Pakkanen
Re-enable various tests on Cygwin
2021-05-23Disable D test on macOS as it fails mysteriously.Jussi Pakkanen
2021-05-23It seems ld64 is the default linker name on macOS now.Jussi Pakkanen
2021-05-21Fix LTO test on CygwinJon Turney
This partially reverts commit add502c6483bde9dc6a0ba80b3c79163304465a4. In 'linkshared' test, annotate cppfunc() as imported, so an indirection through an import stub is generated, avoiding a relocation size error when building using gcc for Cygwin with LTO on. Align with the example of how to write this portably in [1]. The 'c' language part of that test already gets this right. [1] http://gcc.gnu.org/wiki/Visibility
2021-05-18pkgconfig: Do not escape custom variablesXavier Claessens
We need to escape space in variables that gets into cflags or libs because otherwise we cannot split compiler args when paths contains spaces. But custom variables are unlikely to be path that gets used in cflags/libs, and escaping them cause regression in GStreamer that use space as separator in a list variable.