From 6d91ab6ffd27323c7a25b8ead7b37c0e47fb07a7 Mon Sep 17 00:00:00 2001 From: "Javier G. Sogo" Date: Sat, 16 Jul 2022 14:02:47 +0200 Subject: [PATCH] (#11711) [doc] How to disable linter for v1-only tests --- docs/how_to_add_packages.md | 4 ++++ docs/v2_linter.md | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/docs/how_to_add_packages.md b/docs/how_to_add_packages.md index 2bd68064bd7a3..449d1f8726d06 100644 --- a/docs/how_to_add_packages.md +++ b/docs/how_to_add_packages.md @@ -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_` recipes should **test the package configuration that has just been generated** for the _host_ context, otherwise > it will fail in crossbuilding scenarios. diff --git a/docs/v2_linter.md b/docs/v2_linter.md index 0e51cf4d81a0b..df2120f5bf7c4 100644 --- a/docs/v2_linter.md +++ b/docs/v2_linter.md @@ -1,6 +1,9 @@ Linter to help migration to Conan v2 ==================================== + + + 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 +... +``` \ No newline at end of file