Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing handover keyword #117

Merged
merged 4 commits into from
Sep 4, 2021
Merged

Add missing handover keyword #117

merged 4 commits into from
Sep 4, 2021

Conversation

mbhall88
Copy link
Member

@mbhall88 mbhall88 commented Aug 9, 2021

Part of the reason #116 was failing tests was a missing handover keyword that was added in snakemake v6.2.0. I've added that in and updated the lock file due to some other issues alluded to in #116

I've also pre-emptively bumped the version so that when this is merged onto master we can just tag a release on github directly.

@mbhall88 mbhall88 requested a review from bricoletc August 9, 2021 02:16
@codecov
Copy link

codecov bot commented Aug 9, 2021

Codecov Report

Merging #117 (612b9f4) into master (91603a5) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #117   +/-   ##
=======================================
  Coverage   98.21%   98.21%           
=======================================
  Files          12       12           
  Lines         951      951           
  Branches      174      174           
=======================================
  Hits          934      934           
  Misses         10       10           
  Partials        7        7           
Flag Coverage Δ
unittests 98.21% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
snakefmt/parser/grammar.py 100.00% <ø> (ø)

@mbhall88
Copy link
Member Author

mbhall88 commented Aug 9, 2021

I've squashed all of the commits starting with "test". Basically, the pathspec problem encountered in #116 (comment) was an obscure issue with Mac and the name of the default temporary directory. The default Mac temp dir in github actions starts with /private/var/.... Because var/ exists in out .gitignore file, anything in it is ignored, hence the temporary snakefile we create in

def test_src_dir_arg_files_modified_inplace(self, cli_runner):
with tempfile.TemporaryDirectory() as tmpdir:
content = 'include: "a"'
abs_tmpdir = Path(tmpdir).resolve()
snakedir = abs_tmpdir / "workflows"
snakedir.mkdir()
snakefile = snakedir / "Snakefile"
snakefile.write_text(content)
params = [str(tmpdir)]
cli_runner.invoke(main, params)
expected_contents = content + "\n"
actual_contents = snakefile.read_text()
assert actual_contents == expected_contents

was actually ignored, and thus we didn't reformat it and the test failed.

I fixed this by explicitly setting the tempdir for that test to /tmp.

@@ -54,14 +54,14 @@ def test_stdinAsSrc_WritesToStdout(self, cli_runner):
assert actual.output == expected_output

def test_src_dir_arg_files_modified_inplace(self, cli_runner):
with tempfile.TemporaryDirectory() as tmpdir:
with tempfile.TemporaryDirectory(dir="/tmp") as tmpdir:
Copy link
Collaborator

@bricoletc bricoletc Sep 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remind me why this is being done?

What if /tmp does not exist on the host machine the tests run on? Running this with dir="/not_there" fails with FileNotFoundError on my machine

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's basically trying to create a directory structure to test that we are searching for snakefiles and ignoring things that should be ignored etc.

I used /tmp as it seems likely to exist in most places and will be auto cleaned up by the OS usually. I can't use the normal temp dir because as I mentioned above, the Mac CI tests fail.

Happy to change the behaviour to something else though if you have a better idea?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a good alternative be the cwd? So like ., as that is guaranteed to exist?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

everything else looks fine to me so approved

@mbhall88 mbhall88 merged commit a3e8518 into snakemake:master Sep 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants