mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-03 18:14:11 +00:00 
			
		
		
		
	Migrate to pycodestyle and setup a basic config file
Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
		
							parent
							
								
									ed2aef3db1
								
							
						
					
					
						commit
						822a8c712c
					
				@ -3,7 +3,7 @@ tests-stretch:
 | 
				
			|||||||
  image: debian:stretch
 | 
					  image: debian:stretch
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - apt-get update
 | 
					    - apt-get update
 | 
				
			||||||
    - apt-get install -y python3 python3-apt python3-yaml python3-pep8 python3-pytest git rsync libclass-accessor-perl libdpkg-perl libyaml-syck-perl
 | 
					    - apt-get install -y python3 python3-apt python3-yaml python3-pycodestyle python3-pytest git rsync libclass-accessor-perl libdpkg-perl libyaml-syck-perl
 | 
				
			||||||
    - ci/gitlab-ci-runner
 | 
					    - ci/gitlab-ci-runner
 | 
				
			||||||
 | 
					
 | 
				
			||||||
tests-sid:
 | 
					tests-sid:
 | 
				
			||||||
@ -11,7 +11,7 @@ tests-sid:
 | 
				
			|||||||
  image: debian:sid
 | 
					  image: debian:sid
 | 
				
			||||||
  script:
 | 
					  script:
 | 
				
			||||||
    - apt-get update
 | 
					    - apt-get update
 | 
				
			||||||
    - apt-get install -y python3 python3-apt python3-yaml python3-coverage python3-pep8 python3-pytest python3-pytest-cov git rsync libclass-accessor-perl libdpkg-perl libyaml-syck-perl
 | 
					    - apt-get install -y python3 python3-apt python3-yaml python3-coverage python3-pycodestyle python3-pytest python3-pytest-cov git rsync libclass-accessor-perl libdpkg-perl libyaml-syck-perl
 | 
				
			||||||
    - ci/gitlab-ci-runner --with-coverage
 | 
					    - ci/gitlab-ci-runner --with-coverage
 | 
				
			||||||
  artifacts:
 | 
					  artifacts:
 | 
				
			||||||
    paths:
 | 
					    paths:
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,4 @@
 | 
				
			|||||||
FROM debian:stable
 | 
					FROM debian:stable
 | 
				
			||||||
WORKDIR /britney
 | 
					WORKDIR /britney
 | 
				
			||||||
ADD . /britney
 | 
					ADD . /britney
 | 
				
			||||||
RUN apt-get update && apt-get install --no-install-recommends --assume-yes python3 python3-apt python3-yaml python3-coverage python3-nose python3-pep8 rsync libclass-accessor-perl libdpkg-perl libyaml-syck-perl curl
 | 
					RUN apt-get update && apt-get install --no-install-recommends --assume-yes python3 python3-apt python3-yaml python3-coverage python3-nose python3-pycodestyle rsync libclass-accessor-perl libdpkg-perl libyaml-syck-perl curl
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								setup.cfg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								setup.cfg
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,6 @@
 | 
				
			|||||||
 | 
					[pycodestyle]
 | 
				
			||||||
 | 
					count = False
 | 
				
			||||||
 | 
					#ignore = E226,E302,E41
 | 
				
			||||||
 | 
					# 120 is the limit but leave 10% buffer for minor transgressions.
 | 
				
			||||||
 | 
					max-line-length = 130
 | 
				
			||||||
 | 
					statistics = True
 | 
				
			||||||
@ -1,12 +1,15 @@
 | 
				
			|||||||
 | 
					import os
 | 
				
			||||||
import unittest
 | 
					import unittest
 | 
				
			||||||
import pep8
 | 
					import pycodestyle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TestCodeFormat(unittest.TestCase):
 | 
					class TestCodeFormat(unittest.TestCase):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def test_conformance(self):
 | 
					    def test_conformance(self):
 | 
				
			||||||
        """Test that we conform to PEP-8."""
 | 
					        """Test that we conform to PEP-8."""
 | 
				
			||||||
        style = pep8.StyleGuide()
 | 
					        project_dir = os.path.dirname(os.path.dirname(__file__))
 | 
				
			||||||
 | 
					        codestyle_cfg = os.path.join(project_dir, 'setup.cfg')
 | 
				
			||||||
 | 
					        style = pycodestyle.StyleGuide(config_file=codestyle_cfg)
 | 
				
			||||||
        result = style.check_files('.')
 | 
					        result = style.check_files('.')
 | 
				
			||||||
        self.assertEqual(result.total_errors, 0,
 | 
					        self.assertEqual(result.total_errors, 0,
 | 
				
			||||||
                         "Found code style errors (and warnings).")
 | 
					                         "Found code style errors (and warnings).")
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user