Skip to content

Fix spack view hardlink#6130

Merged
scheibelp merged 1 commit intospack:developfrom
electronicvisions:hardlink
Nov 7, 2017
Merged

Fix spack view hardlink#6130
scheibelp merged 1 commit intospack:developfrom
electronicvisions:hardlink

Conversation

@kljohann
Copy link
Copy Markdown
Contributor

@kljohann kljohann commented Nov 3, 2017

This fixes a "typo" in spack view hardlink as introduced in #3227 / #5415. (os.hardlink does not exist)

@kljohann
Copy link
Copy Markdown
Contributor Author

kljohann commented Nov 3, 2017

It probably makes sense to add a test.

@kljohann
Copy link
Copy Markdown
Contributor Author

kljohann commented Nov 3, 2017

Done. :) @scheibelp Maybe you can look at this since you are already familiar with the original code.

install('libdwarf')
for symlink in [True, False]:
cmd = ["hardlink", "symlink"][symlink]
viewpath = str(tmpdir.mkdir('view_{}'.format(cmd)))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The {} format syntax doesn't work in python 2.6, indices are required

tmpdir, builtin_mock, mock_archive, mock_fetch, config,
install_mockery):
install('libdwarf')
for symlink in [True, False]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IMO this (and indexing by boolean on the next line) is a bit esoteric: I'd prefer for symlink, cmd in [(True, 'symlink'), (False, 'hardlink')]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this is a good place to use parametrized tests. Grep around for pytest.mark.parametrized in the other tests and you can probably find an example -- you can let pytest do this work for you and just refer to parameters.

@kljohann kljohann force-pushed the hardlink branch 2 times, most recently from 3211bd6 to 6b453f5 Compare November 5, 2017 18:25
@kljohann
Copy link
Copy Markdown
Contributor Author

kljohann commented Nov 5, 2017

Changed to use parametrized tests.

tmpdir, builtin_mock, mock_archive, mock_fetch, config,
install_mockery, cmd):
install('libdwarf')
viewpath = str(tmpdir.mkdir('view_{}'.format(cmd)))
Copy link
Copy Markdown
Member

@scheibelp scheibelp Nov 6, 2017

Choose a reason for hiding this comment

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

If you replace view_{} with view{0} (EDIT) view_{0} all test failures should be resolved.

@kljohann
Copy link
Copy Markdown
Contributor Author

kljohann commented Nov 6, 2017

Sorry, I forgot about the python 2.6 issue. Fixed and thanks for your help :)

@scheibelp scheibelp merged commit ac3a807 into spack:develop Nov 7, 2017
@scheibelp
Copy link
Copy Markdown
Member

Sorry, I forgot about the python 2.6 issue. Fixed and thanks for your help :)

Totally fine - thanks for fixing the bug!

@healther healther deleted the hardlink branch November 13, 2017 08:34
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.

3 participants