-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from keshav-space/main
Add black codestyle test for skeleton
- Loading branch information
Showing
5 changed files
with
44 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# | ||
# Copyright (c) nexB Inc. and others. All rights reserved. | ||
# ScanCode is a trademark of nexB Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text. | ||
# See https://github.com/nexB/skeleton for support or download. | ||
# See https://aboutcode.org for more information about nexB OSS projects. | ||
# | ||
|
||
import subprocess | ||
import unittest | ||
import configparser | ||
|
||
|
||
class BaseTests(unittest.TestCase): | ||
def test_skeleton_codestyle(self): | ||
""" | ||
This test shouldn't run in proliferated repositories. | ||
""" | ||
setup_cfg = configparser.ConfigParser() | ||
setup_cfg.read("setup.cfg") | ||
if setup_cfg["metadata"]["name"] != "skeleton": | ||
return | ||
|
||
args = "venv/bin/black --check -l 100 setup.py etc tests" | ||
try: | ||
subprocess.check_output(args.split()) | ||
except subprocess.CalledProcessError as e: | ||
print("===========================================================") | ||
print(e.output) | ||
print("===========================================================") | ||
raise Exception( | ||
"Black style check failed; please format the code using:\n" | ||
" python -m black -l 100 setup.py etc tests", | ||
e.output, | ||
) from e |