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

fix/integration test for pants_requirement() #5457

Merged
4 changes: 2 additions & 2 deletions src/python/pants/backend/python/pants_requirement.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import os

from pants.backend.python.python_requirement import PythonRequirement
from pants.backend.python.targets.python_requirement_library import PythonRequirementLibrary
from pants.base.build_environment import pants_version


Expand All @@ -34,5 +33,6 @@ def __call__(self, name=None):
"""
name = name or os.path.basename(self._parse_context.rel_path)
requirement = PythonRequirement(requirement='pantsbuild.pants=={}'.format(pants_version()))
self._parse_context.create_object(PythonRequirementLibrary, name=name,
self._parse_context.create_object('python_requirement_library',
name=name,
requirements=[requirement])
1 change: 1 addition & 0 deletions testprojects/pants-plugins/3rdparty/pants/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pants_requirement()
Copy link
Member

Choose a reason for hiding this comment

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

Should this... have an argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not necessarily, and not needed for this purpose. See test_pants_requirement.py for an example of providing a name and not.

7 changes: 7 additions & 0 deletions testprojects/pants-plugins/tests/pants_test/new_package/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
python_tests(
dependencies=[
'tests/python/pants_test:test_infra',
'testprojects/pants-plugins/3rdparty/pants',
],
tags={'integration'},
Copy link
Member

Choose a reason for hiding this comment

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

This isn't currently an integration test, but maybe it should be? See below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out here too -- this was removed as well.

)
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# coding=utf-8
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
Copy link
Member

Choose a reason for hiding this comment

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

2018

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has now been fixed.

# Licensed under the Apache License, Version 2.0 (see LICENSE).

from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)

from pants.base.build_environment import pants_version
from pants.version import VERSION as _VERSION
from pants_test.base_test import BaseTest


class PantsPluginPantsRequirementTest(BaseTest):
Copy link
Member

Choose a reason for hiding this comment

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

It's not clear that this is testing what it is testing... maybe an integration test that runs some pants command on the target?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out, this was completely removed.

def test_version(self):
self.assertEqual(pants_version(), _VERSION)