Skip to content

Commit

Permalink
Fix gen command changing modification date of shell ingen (#124)
Browse files Browse the repository at this point in the history
* Remove fixing of line endings for shell scripts

* Add tests
  • Loading branch information
MasloMaslane authored Sep 21, 2023
1 parent e5b620a commit 2ecb060
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/sinol_make/commands/gen/gen_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def run_ingen(ingen_exe, working_dir=None):

is_shell = os.path.splitext(ingen_exe)[1] == '.sh'
if is_shell:
util.fix_line_endings(ingen_exe)
st = os.stat(ingen_exe)
os.chmod(ingen_exe, st.st_mode | stat.S_IEXEC)

Expand Down
16 changes: 16 additions & 0 deletions tests/commands/gen/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

from sinol_make import configure_parsers
from sinol_make.commands.gen import Command
from sinol_make.commands.gen import gen_util
from sinol_make.helpers import package_util
from tests.fixtures import *
from tests import util

Expand Down Expand Up @@ -79,3 +81,17 @@ def test_changed_inputs(capsys, create_package):
assert "Successfully generated output file " + os.path.basename(file.replace("in", "out")) in out
assert "Successfully generated all output files." in out
assert correct_md5 == get_md5_sums(create_package)


@pytest.mark.parametrize("create_package", [util.get_shell_ingen_pack_path()], indirect=True)
def test_shell_ingen_unchanged(create_package):
"""
Test if ingen.sh is unchanged after running `ingen` command.
"""
package_path = create_package
task_id = package_util.get_task_id()
shell_ingen_path = gen_util.get_ingen(task_id)
assert os.path.splitext(shell_ingen_path)[1] == ".sh"
edited_time = os.path.getmtime(shell_ingen_path)
simple_run()
assert edited_time == os.path.getmtime(shell_ingen_path)

0 comments on commit 2ecb060

Please sign in to comment.