summaryrefslogtreecommitdiff
path: root/unittests/internaltests.py
Commit message (Collapse)AuthorAgeFilesLines
* add message option to since_values and deprecated_valuesDylan Baker2021-12-061-1/+9
| | | | | This allows these two arguments to take a tuple of (version, message), where the message will be passed to Feature*'s message parameter
* unittests/internal: use more subTestDylan Baker2021-12-061-13/+11
|
* Add deprecated_message and since_message to KwargInfoDylan Baker2021-12-061-6/+6
| | | | | | For passing an extra message to Feature* This allows providing a more detailed message.
* unittests/internal: use mock and subTestDylan Baker2021-12-061-7/+9
| | | | | This just makes things a little cleaner, and allows more accurate error reporting.
* interpreterbase/decorators: Fix types of deprecated_values and since_valuesDylan Baker2021-12-061-0/+5
| | | | | Which shouldn't be Dict[str, str], they should be Dict[_T, str], as nay value that can be passed to types is valid here.
* Merge pull request #9599 from dcbaker/submit/typed_kwargs-message-improvementsJussi Pakkanen2021-11-271-4/+4
|\ | | | | Improve error messages for typed_kwarg type mismatches in containers
| * unittests: cover cases here two of the same wrong type are providedDylan Baker2021-11-221-1/+1
| | | | | | | | | | We don't want to get something like "expected array[str], but got array[int | int]", we really want `arrayp[int]`.
| * typed_kwargs: use | for type unions, not ,Dylan Baker2021-11-221-2/+2
| | | | | | | | Python uses this syntax now, as does typescript and other languages
| * typed_kwargs: provide better error messages for wrong container typesDylan Baker2021-11-221-3/+3
| | | | | | | | | | | | | | Currently, if you pass a `[]string`, but the argument expects `[]number`, then you get a message like `expected list[str] but got list`. That isn't helpful. With this patch arrays and dictionaries will both print messages with the types provided.
* | tests: add a test for OptionKey.from_stringDylan Baker2021-11-251-0/+19
|/
* Fix typos discovered by codespellChristian Clauss2021-10-101-1/+1
|
* typed_kwargs: Fix when ContainerTypeInfo is used in a tupleXavier Claessens2021-10-091-4/+37
| | | | | | | | | | info.types could be a tuple like (str, ContainerTypeInfo()). That means we have to check types one by one and only print error if none of them matched. Also fix the case when default value is None for a container type, it should leave the value to None to be able to distinguish between unset and empty list.
* various python neatness cleanupsEli Schwartz2021-10-041-2/+2
| | | | | | | | | | | | | | | | All changes were created by running "pyupgrade --py3-only" and committing the results. Although this has been performed in the past, newer versions of pyupgrade can automatically catch more opportunities, notably list comprehensions can use generators instead, in the following cases: - unpacking into function arguments as function(*generator) - unpacking into assignments of the form x, y = generator - as the argument to some builtin functions such as min/max/sorted Also catch a few creeping cases of new code added using older styles.
* coredata: 0.59.1 -> 0.59.99 is a major version differenceXavier Claessens2021-09-211-1/+15
| | | | | | | | | | | | Remove test_minor_version_does_not_reconfigure_wipe() because when run during dev cycle that test reconfigure with .99 -> .100 which is considered a major version change now. It is covered by a more efficient internal test now anyway. While at it, remove no-op `with Path(self.builddir):` statement, the intention was clearly to set workdir. Fixes: #9260
* interpreter: use python dunders instead of lock for unpicklabilityDylan Baker2021-08-311-1/+1
| | | | | | | This simplifies things for us, as we don't have to have threading imported for no other reason, and we can remove the `an_unpicklable_object` from the Interpreter and mesonlib, since there was only one user of this.
* unittests: add a test to Interpreter is unpicklableDylan Baker2021-08-311-7/+17
| | | | We want this, so let's test it.
* environment: correctly handle cpu value aarch64_beDylan Baker2021-08-301-0/+4
| | | | Fixes #9191
* environment: add ppc -> ppc64 for aix to detect_cpuDylan Baker2021-08-301-1/+1
| | | | | This seems like an oversight, that we'd replace ppc with ppc64 on AIX for the cpu_family, but not for the specific cpu.
* unittests: add tests for detect_cpuDylan Baker2021-08-301-0/+35
| | | | Same thing, but for the more specific cases
* unittests: Add a test case for detect_cpu_familyDylan Baker2021-08-301-0/+56
| | | | This should help prevent regressions.
* interpreter: fix cases of `KwargInfo(..., T, default=None)`Dylan Baker2021-08-271-7/+8
| | | | | | The correct way to mark these is `KwargInfo(..., (T, type(None)))`. There's also a few cases of `(T, None)` which is invalid, as `None` isn't a type
* interpreter: Add a helper for checking constrained inputsDylan Baker2021-08-271-1/+2
| | | | | This is quite valuable for enum-like inputs, where only a certain set of values is allowed.
* interenaltests: Add some version strings with ansi escapes in themDylan Baker2021-07-301-0/+11
| | | | | AS we've run into a few programs using ansi escapes in their version outputs, we'd like to test them as well.
* Split run_unittests.py fileXavier Claessens2021-07-261-0/+1411