mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Speedup the test suite by tidyall caching.
Of flake8. TODO: put on CPAN.
This commit is contained in:
parent
4f5d365763
commit
0a05c3c9cf
4 changed files with 57 additions and 63 deletions
|
@ -1,3 +1,7 @@
|
|||
[Flake8]
|
||||
ignore = tests/individually-importing/*
|
||||
select = **/*.py
|
||||
|
||||
[PerlTidy]
|
||||
argv = -ci=4 -bl -cti=0
|
||||
ignore = **/{cmpdigest,valgrind,verify}--*.t
|
||||
|
|
3
Makefile
3
Makefile
|
@ -67,7 +67,8 @@ pretest:
|
|||
@rm -f tests/individually-importing/*.py # To avoid stray files
|
||||
python scripts/gen_individual_importing_tests.py
|
||||
|
||||
TEST_ENV = PYTHONPATH="`pwd`:`pwd`/tests/lib"
|
||||
TEST_ENV_PATH = "`pwd`:`pwd`/tests/lib"
|
||||
TEST_ENV = PYTHONPATH=$(TEST_ENV_PATH) PERL5LIB=$(TEST_ENV_PATH)
|
||||
TEST_FILES = tests/style/*.t tests/unit-generated/*.py tests/individually-importing/*.py
|
||||
|
||||
define RUN_TESTS
|
||||
|
|
51
tests/lib/Code/TidyAll/Plugin/Flake8.pm
Normal file
51
tests/lib/Code/TidyAll/Plugin/Flake8.pm
Normal file
|
@ -0,0 +1,51 @@
|
|||
package Code::TidyAll::Plugin::Flake8;
|
||||
|
||||
use Moo;
|
||||
use String::ShellQuote qw/ shell_quote /;
|
||||
|
||||
extends 'Code::TidyAll::Plugin';
|
||||
|
||||
sub validate_file
|
||||
{
|
||||
my ( $self, $fn ) = @_;
|
||||
my $cmd = shell_quote( 'flake8', $fn );
|
||||
if (`$cmd`)
|
||||
{
|
||||
die 'not valid';
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 COPYRIGHT & LICENSE
|
||||
|
||||
Copyright 2018 by Shlomi Fish
|
||||
|
||||
This program is distributed under the MIT / Expat License:
|
||||
L<http://www.opensource.org/licenses/mit-license.php>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
=cut
|
|
@ -1,62 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use Test::More;
|
||||
use Test::Differences qw( eq_or_diff );
|
||||
|
||||
use File::Find::Object ();
|
||||
use String::ShellQuote qw/ shell_quote /;
|
||||
|
||||
if ( $^O =~ /\AMSWin/ )
|
||||
{
|
||||
plan skip_all => "command line exceeded on ms windows.";
|
||||
}
|
||||
else
|
||||
{
|
||||
plan tests => 1;
|
||||
}
|
||||
|
||||
my %skip = (
|
||||
map { $_ => 1 }
|
||||
qw(
|
||||
)
|
||||
);
|
||||
|
||||
my $tree = File::Find::Object->new( {}, '.' );
|
||||
my @filenames;
|
||||
while ( my $r = $tree->next_obj )
|
||||
{
|
||||
my $fn = $r->path;
|
||||
if ( $fn eq '.git' or $fn eq 'tests/individually-importing' )
|
||||
{
|
||||
$tree->prune;
|
||||
}
|
||||
elsif ( $fn =~ /\.py\z/ and !exists( $skip{$fn} ) )
|
||||
{
|
||||
push @filenames, $fn;
|
||||
}
|
||||
}
|
||||
|
||||
my $cmd = shell_quote( 'flake8', @filenames );
|
||||
|
||||
# diag("<$cmd>");
|
||||
|
||||
# TEST
|
||||
eq_or_diff( scalar(`$cmd`), '', "flake8 is happy with the code." );
|
||||
|
||||
__END__
|
||||
|
||||
=head1 COPYRIGHT AND LICENSE
|
||||
|
||||
This file is part of Freecell Solver. It is subject to the license terms in
|
||||
the COPYING.txt file found in the top-level directory of this distribution
|
||||
and at http://fc-solve.shlomifish.org/docs/distro/COPYING.html . No part of
|
||||
Freecell Solver, including this file, may be copied, modified, propagated,
|
||||
or distributed except according to the terms contained in the COPYING file.
|
||||
|
||||
Copyright (c) 2016 Shlomi Fish
|
||||
|
||||
=cut
|
||||
|
Loading…
Add table
Reference in a new issue