File indexing completed on 2024-05-19 05:21:55

0001 # Copyright (c) 2019 Alexander Potashev <aspotashev@gmail.com>
0002 #
0003 # This program is free software; you can redistribute it and/or
0004 # modify it under the terms of the GNU General Public License as
0005 # published by the Free Software Foundation; either version 2 of
0006 # the License or (at your option) version 3 or any later version
0007 # accepted by the membership of KDE e.V. (or its successor approved
0008 # by the membership of KDE e.V.), which shall act as a proxy
0009 # defined in Section 14 of version 3 of the license.
0010 #
0011 # This program is distributed in the hope that it will be useful,
0012 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0013 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0014 # GNU General Public License for more details.
0015 #
0016 # You should have received a copy of the GNU General Public License
0017 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
0018 
0019 import os
0020 
0021 
0022 # Regression testing for https://bugs.kde.org/show_bug.cgi?id=94447
0023 #
0024 # Create files relative to current directory if no "/" prefix
0025 # in file name given on command line.
0026 def test_relative_path(app):
0027     try:
0028         os.remove('/tmp/testktimetracker1.ics')
0029     except FileNotFoundError:
0030         pass
0031 
0032     os.chdir('/tmp')
0033     app.run('testktimetracker1.ics')
0034 
0035     app.addTask('Task1')
0036     app.saveAll()
0037     assert os.path.isfile('/tmp/testktimetracker1.ics')