Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/sinol_make/commands/export/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,11 @@ def copy_package_required_files(self, target_dir: str):
st = os.stat(shell_ingen)
os.chmod(shell_ingen, st.st_mode | stat.S_IEXEC)

# Remove '.e' files from prog directory
prog_dir = os.path.join(target_dir, 'prog')
for file in glob.glob(os.path.join(prog_dir, f'{self.task_id}*.e')):
os.remove(file)

print('Copying example tests...')
for ext in ['in', 'out']:
os.mkdir(os.path.join(target_dir, ext))
Expand Down
25 changes: 25 additions & 0 deletions tests/commands/export/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,28 @@ def test_dlazaw_ocen(create_package):

assert not os.path.exists(os.path.join(tmpdir, task_id, "attachments", f"{task_id}ocen.zip"))
assert os.path.join(tmpdir, task_id, "attachments", f"dlazaw.zip")


@pytest.mark.parametrize("create_package", [util.get_simple_package_path()], indirect=True)
def test_e_files_removal(create_package):
"""
Test if .e files are removed from the prog directory in the archive.
"""
package_path = create_package
task_id = package_util.get_task_id()
prog_path = os.path.join(package_path, "prog")
e_file = os.path.join(prog_path, f"{task_id}e.e")
with open(e_file, "w") as f:
f.write("This is a test e file.")

parser = configure_parsers()
args = parser.parse_args(["export", "--no-statement"])
command = Command()
command.run(args)

with tempfile.TemporaryDirectory() as tmpdir:
with tarfile.open(f'{task_id}.tgz', "r") as tar:
sinol_util.extract_tar(tar, tmpdir)

extracted = os.path.join(tmpdir, task_id)
assert not os.path.exists(os.path.join(extracted, "prog", f"{task_id}e.e"))
Loading