"Fossies" - the Fresh Open Source Software Archive

Member "TaskCoach-1.4.3/tests/releasetests/LineEndingsTest.py" (31 Jan 2016, 1511 Bytes) of archive /windows/misc/TaskCoach-1.4.3.zip:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "LineEndingsTest.py": 1.4.2_vs_1.4.3.

    1 '''
    2 Task Coach - Your friendly task manager
    3 Copyright (C) 2004-2016 Task Coach developers <developers@taskcoach.org>
    4 
    5 Task Coach is free software: you can redistribute it and/or modify
    6 it under the terms of the GNU General Public License as published by
    7 the Free Software Foundation, either version 3 of the License, or
    8 (at your option) any later version.
    9 
   10 Task Coach is distributed in the hope that it will be useful,
   11 but WITHOUT ANY WARRANTY; without even the implied warranty of
   12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   13 GNU General Public License for more details.
   14 
   15 You should have received a copy of the GNU General Public License
   16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
   17 '''
   18 
   19 import os, test
   20 
   21 # Tests are run with ./tests as current dir, but setup.py expects the project
   22 # root folder to be the current dir. Work around that by changing
   23 # the current dir while importing setup.py:
   24 cwd = os.path.realpath(os.path.curdir)
   25 os.chdir('..')
   26 import setup
   27 os.chdir(cwd)
   28 
   29 
   30 class LineEndingsTest(test.TestCase):
   31     def testNoDOSLineEndingsInPythonScripts(self):
   32         ''' On Linux, scripts won't work if they have DOS line endings. '''
   33         scripts = [os.path.join(test.projectRoot, script) \
   34                    for script in setup.setupOptions['scripts'] \
   35                    if script.endswith('.py')]
   36         for script in scripts:
   37             self.failIf('\r\n' in file(script, 'rb').read(), 
   38                         '%s contains DOS line endings'%script)