# Copyright Kevin Deldycke <kevin@deldycke.com> and contributors.## This program is Free Software; you can redistribute it and/or# modify it under the terms of the GNU General Public License# as published by the Free Software Foundation; either version 2# of the License, or (at your option) any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program; if not, write to the Free Software# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.from__future__importannotationsfrommailboximportMaildir
[docs]deftest_early_export_file_check(invoke,make_box,tmp_path):"""Ensures the export file is tested for existence before any process is ran. See: https://github.com/kdeldycke/mail-deduplicate/issues/119 """box_path,_=make_box(Maildir)result=invoke("--export=non_existing.file",box_path)assertresult.exit_code==0assert"0 mails found."inresult.stderrassert"β Step #1"inresult.stdoutassert"non_existing.file"notinresult.stderrfile=tmp_path.joinpath("existing.file")file.touch()result=invoke(f"--export={file!s}",box_path)assertresult.exit_code==1assertresult.stderr==""assertstr(result.exception)==str(file)