summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-05 00:06:13 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2021-04-05 15:08:27 +0200
commitfe7f36dfd7e67527392f37af6fd2c2b7738eb757 (patch)
treea3616266f273b7f6d43992b5365b439c83a42dcb
parentf233db10166e96a55655ca2794428455ad9bf454 (diff)
downloadpylint-git-fe7f36dfd7e67527392f37af6fd2c2b7738eb757.tar.gz
Fix test failing if setup.py is not a launchable script
-rw-r--r--setup.py3
-rw-r--r--tests/benchmark/test_baseline_benchmarks.py9
2 files changed, 7 insertions, 5 deletions
diff --git a/setup.py b/setup.py
index 7f1a1763c..606849326 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,3 @@
from setuptools import setup
-if __name__ == "__main__":
- setup()
+setup()
diff --git a/tests/benchmark/test_baseline_benchmarks.py b/tests/benchmark/test_baseline_benchmarks.py
index 6f79b1d7b..60ab96574 100644
--- a/tests/benchmark/test_baseline_benchmarks.py
+++ b/tests/benchmark/test_baseline_benchmarks.py
@@ -12,6 +12,7 @@
import os
import pprint
import time
+from unittest.mock import patch
import pytest
@@ -340,9 +341,11 @@ class TestEstablishBaselineBenchmarks:
linter = PyLinter()
# Register all checkers/extensions and enable them
- register_plugins(
- linter, os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
- )
+ with patch("os.listdir", return_value=["pylint", "tests"]):
+ register_plugins(
+ linter,
+ os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")),
+ )
linter.load_default_plugins()
linter.enable("all")