(#11711) [doc] How to disable linter for v1-only tests

This commit is contained in:
Javier G. Sogo
2022-07-16 14:02:47 +02:00
committed by GitHub
parent c81daa7833
commit 6d91ab6ffd
2 changed files with 22 additions and 0 deletions

View File

@@ -188,6 +188,10 @@ project files as simple as possible, without the need of extra logic to handle d
The CI will explore all the folders and run the tests for the ones matching `test_*/conanfile.py` pattern. You can find the output of all
of them together in the testing logs.
> **Note.-** If, for any reason, it is useful to write a test that should only be checked using Conan v1, you can do so by using the pattern
> `test_v1_*/conanfile.py` for the folder. Please, have a look to [linter notes](v2_linter.md) to know how to prevent the linter from
> checking these files.
> Remember that the `test_<package>` recipes should **test the package configuration that has just been generated** for the _host_ context, otherwise
> it will fail in crossbuilding scenarios.

View File

@@ -1,6 +1,9 @@
Linter to help migration to Conan v2
====================================
<!-- toc -->
<!-- endToc -->
On our [path to Conan v2](v2_roadmap.md) we are leveraging on custom Pylint rules. This
linter will run for every pull-request that is submitted to the repository and will
raise some warnings and errors that should be addressed in order to migrate the
@@ -42,3 +45,18 @@ class Recipe(ConanFile):
if not cross_building(self):
pass
```
# Disable linter for `test_v1_*/conanfile.py`
Using the pattern `test_v1_*/conanfile.py` you can write a test that will be executed using only Conan v1,
you probably don't want v2-migration linter to check this file, as it will likely contain syntax that is
specific to Conan v1.
To skip the file you just need to add the following comment to the file and `pylint` will skip it:
**`test_v1_*/conanfile.py`**
```python
# pylint: skip-file
from conans import ConanFile, CMake, tools
...
```