|
1 | 1 | from pathlib import Path |
2 | 2 |
|
3 | | -from _pytest.logging import LogCaptureFixture |
| 3 | +from _pytest.logging import LogCaptureFixture # pyright: ignore [reportMissingImports] |
4 | 4 | from loguru import logger |
5 | 5 |
|
6 | 6 | from licensecheck import license_matrix, types |
@@ -53,16 +53,21 @@ def test_dualLicenseCompat() -> None: |
53 | 53 | def test_whitelistedLicenseCompat() -> None: |
54 | 54 | assert license_matrix.depCompatWMyLice(types.L.MIT, [types.L.MIT], onlyLicenses=[types.L.MIT]) |
55 | 55 | assert license_matrix.depCompatWMyLice(types.L.MPL, [types.L.MIT], onlyLicenses=[types.L.MIT]) |
56 | | - assert not license_matrix.depCompatWMyLice(types.L.MIT, [types.L.MIT], onlyLicenses=[types.L.MPL]) |
57 | | - assert not license_matrix.depCompatWMyLice(types.L.MPL, [types.L.MIT], onlyLicenses=[types.L.MPL]) |
| 56 | + assert not license_matrix.depCompatWMyLice( |
| 57 | + types.L.MIT, [types.L.MIT], onlyLicenses=[types.L.MPL] |
| 58 | + ) |
| 59 | + assert not license_matrix.depCompatWMyLice( |
| 60 | + types.L.MPL, [types.L.MIT], onlyLicenses=[types.L.MPL] |
| 61 | + ) |
58 | 62 |
|
59 | 63 |
|
60 | 64 | def test_warningsForIgnoredLicense(caplog: LogCaptureFixture) -> None: |
61 | 65 | zope = types.ucstr("ZOPE PUBLIC LICENSE") |
62 | 66 | license_matrix.licenseLookup(zope, []) |
63 | | - assert ( |
64 | | - "'ZOPE PUBLIC LICENSE' License not identified so falling back to NO_LICENSE\n" |
65 | | - in caplog.text |
| 67 | + assert any( |
| 68 | + record.levelname == "WARNING" |
| 69 | + and f"'{zope}' License not identified so falling back to NO_LICENSE" in record.message |
| 70 | + for record in caplog.records |
66 | 71 | ) |
67 | 72 |
|
68 | 73 |
|
|
0 commit comments