Skip to content

Conversation

@teojgo
Copy link
Contributor

@teojgo teojgo commented May 25, 2018

Copy link
Contributor

@vkarak vkarak left a comment

Choose a reason for hiding this comment

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

It's a good opportunity to switch this test to the new syntax as well.

@teojgo
Copy link
Contributor Author

teojgo commented May 25, 2018

@jenkins-cscs retry all

super().__init__(name, os.path.dirname(__file__), **kwargs)
class GromacsBaseCheck(rfm.RunOnlyRegressionTest):
def __init__(self, name, output_file):
super().__init__(name, os.path.dirname(__file__))
Copy link
Contributor

Choose a reason for hiding this comment

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

Passing arguments to the base constructor is not so new-stylish, and I don't know if it's gonna be supported in the future. The arguments are there just for backward compatibility. The correct way to do it is to set the name and the description afterwards, like that:

class GromacsBaseCheck(rfm.RunOnlyRegressionTest):
    def __init__(self, name, output_file):
        super().__init__()
        self.name = name
        self.descr = 'my gromacs test'

If you set the test's name this way, it is important to set the description also, cos it will hold the automatically generated name otherwise.

}


@rfm.parameterized_test([(1,), (2,), (4,), (6,), (8,)])
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of using tuples, it's perhaps more compact to use one-element lists:

@rfm.parameterized_test([[1], [2], [4], [6], [8]])

Perhaps, I could also update the documentation to show the example with lists instead of tuples.

Copy link
Contributor

@vkarak vkarak May 25, 2018

Choose a reason for hiding this comment

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

In #294, I have changed the decorator to accept multiple arguments, so that you can write this nicer as follows:

@rfm.parameterized_test([1], [2], [4], [6], [8])

You can even use a range as follows:

@rfm.parameterized_test([1], *([x] for x in range(2,9,2)))

Copy link
Contributor

Choose a reason for hiding this comment

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

#294 is merged, so you can now use the syntax without the extra brackets.

def __init__(self, num_nodes, **kwargs):
nodes_label = 'node' if num_nodes == 1 else 'nodes'
def __init__(self, variant):
nodes_label = 'node' if variant == 1 else 'nodes'
Copy link
Contributor

Choose a reason for hiding this comment

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

You could simply write "node(s)" and avoid this extra complication here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I find the original argument name (num_nodes) more accurate than the variant.

@vkarak vkarak merged commit 30ac3de into master May 28, 2018
@vkarak vkarak deleted the regression-test/gromacs_update branch May 28, 2018 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants