Skip to content

Commit

Permalink
(#11711) [doc] How to disable linter for v1-only tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jgsogo committed Jul 16, 2022
1 parent c81daa7 commit 6d91ab6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/how_to_add_packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 18 additions & 0 deletions docs/v2_linter.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
...
```

0 comments on commit 6d91ab6

Please sign in to comment.