-
Notifications
You must be signed in to change notification settings - Fork 266
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 #13743 from Avinesh/python-flake8
Add regression test for python-flake8 package
- Loading branch information
Showing
5 changed files
with
57 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Sample python file for flake8 test | ||
|
||
#An incorrectly formatted comment - pycodestyle E265 | ||
|
||
# Unused import - pyflakes F401 | ||
import os | ||
|
||
|
||
def sample_print(): | ||
print("A sample python program") | ||
|
||
|
||
sample_print() |
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,38 @@ | ||
# SUSE's openQA tests | ||
# | ||
# Copyright (C) 2021 SUSE LLC | ||
# | ||
# Copying and distribution of this file, with or without modification, | ||
# are permitted in any medium without royalty provided the copyright | ||
# notice and this notice are preserved. This file is offered as-is, | ||
# without any warranty. | ||
# Summary: Regression test for python-flake8 | ||
# Maintainer: QE-Core <qe-core@suse.de> | ||
|
||
|
||
use base "consoletest"; | ||
use strict; | ||
use warnings; | ||
use testapi; | ||
use utils 'zypper_call'; | ||
|
||
sub run { | ||
my $self = shift; | ||
$self->select_serial_terminal; | ||
|
||
# Make sure that python-flake8 is installed. | ||
# On SLE, this requires phub extenstion | ||
zypper_call 'in python3-flake8'; | ||
|
||
# Test case 1: check if flake8 is functional | ||
assert_script_run('mkdir /tmp/empty_dir'); | ||
assert_script_run('flake8 /tmp/empty_dir'); | ||
|
||
# Test case 2: check if flake8 is working as expected | ||
assert_script_run('curl -O ' . data_url("python/sample.py")); | ||
validate_script_output('flake8 --exit-zero sample.py', sub { m/E265 block comment should start with '# '/ && m/F401 'os' imported but unused/ }); | ||
script_run('rm sample.py'); | ||
script_run('rmdir /tmp/empty_dir'); | ||
} | ||
|
||
1; |