diff options
Diffstat (limited to 'gazelle/python/testdata/naming_convention')
18 files changed, 258 insertions, 0 deletions
diff --git a/gazelle/python/testdata/naming_convention/BUILD.in b/gazelle/python/testdata/naming_convention/BUILD.in new file mode 100644 index 0000000..7517848 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/BUILD.in @@ -0,0 +1,3 @@ +# gazelle:python_library_naming_convention my_$package_name$_library +# gazelle:python_binary_naming_convention my_$package_name$_binary +# gazelle:python_test_naming_convention my_$package_name$_test diff --git a/gazelle/python/testdata/naming_convention/BUILD.out b/gazelle/python/testdata/naming_convention/BUILD.out new file mode 100644 index 0000000..e2f0674 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/BUILD.out @@ -0,0 +1,26 @@ +load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") + +# gazelle:python_library_naming_convention my_$package_name$_library +# gazelle:python_binary_naming_convention my_$package_name$_binary +# gazelle:python_test_naming_convention my_$package_name$_test + +py_library( + name = "my_naming_convention_library", + srcs = ["__init__.py"], + visibility = ["//:__subpackages__"], +) + +py_binary( + name = "my_naming_convention_binary", + srcs = ["__main__.py"], + main = "__main__.py", + visibility = ["//:__subpackages__"], + deps = [":my_naming_convention_library"], +) + +py_test( + name = "my_naming_convention_test", + srcs = ["__test__.py"], + main = "__test__.py", + deps = [":my_naming_convention_library"], +) diff --git a/gazelle/python/testdata/naming_convention/README.md b/gazelle/python/testdata/naming_convention/README.md new file mode 100644 index 0000000..9dd88ec --- /dev/null +++ b/gazelle/python/testdata/naming_convention/README.md @@ -0,0 +1,4 @@ +# Naming convention + +This test case asserts that py\_{library,binary,test} targets are generated +correctly based on the directives that control their naming conventions. diff --git a/gazelle/python/testdata/naming_convention/WORKSPACE b/gazelle/python/testdata/naming_convention/WORKSPACE new file mode 100644 index 0000000..faff6af --- /dev/null +++ b/gazelle/python/testdata/naming_convention/WORKSPACE @@ -0,0 +1 @@ +# This is a Bazel workspace for the Gazelle test data. diff --git a/gazelle/python/testdata/naming_convention/__init__.py b/gazelle/python/testdata/naming_convention/__init__.py new file mode 100644 index 0000000..7307559 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. diff --git a/gazelle/python/testdata/naming_convention/__main__.py b/gazelle/python/testdata/naming_convention/__main__.py new file mode 100644 index 0000000..a3afc79 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/__main__.py @@ -0,0 +1,16 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. +import __init__
\ No newline at end of file diff --git a/gazelle/python/testdata/naming_convention/__test__.py b/gazelle/python/testdata/naming_convention/__test__.py new file mode 100644 index 0000000..a3afc79 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/__test__.py @@ -0,0 +1,16 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. +import __init__
\ No newline at end of file diff --git a/gazelle/python/testdata/naming_convention/dont_rename/BUILD.in b/gazelle/python/testdata/naming_convention/dont_rename/BUILD.in new file mode 100644 index 0000000..8d2ae35 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/dont_rename/BUILD.in @@ -0,0 +1,7 @@ +load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") + +py_library( + name = "dont_rename", + srcs = ["__init__.py"], + visibility = ["//:__subpackages__"], +) diff --git a/gazelle/python/testdata/naming_convention/dont_rename/BUILD.out b/gazelle/python/testdata/naming_convention/dont_rename/BUILD.out new file mode 100644 index 0000000..4d4ead8 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/dont_rename/BUILD.out @@ -0,0 +1,25 @@ +load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") + +py_library( + name = "dont_rename", + srcs = ["__init__.py"], + imports = [".."], + visibility = ["//:__subpackages__"], +) + +py_binary( + name = "my_dont_rename_binary", + srcs = ["__main__.py"], + imports = [".."], + main = "__main__.py", + visibility = ["//:__subpackages__"], + deps = [":dont_rename"], +) + +py_test( + name = "my_dont_rename_test", + srcs = ["__test__.py"], + imports = [".."], + main = "__test__.py", + deps = [":dont_rename"], +) diff --git a/gazelle/python/testdata/naming_convention/dont_rename/__init__.py b/gazelle/python/testdata/naming_convention/dont_rename/__init__.py new file mode 100644 index 0000000..7307559 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/dont_rename/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. diff --git a/gazelle/python/testdata/naming_convention/dont_rename/__main__.py b/gazelle/python/testdata/naming_convention/dont_rename/__main__.py new file mode 100644 index 0000000..a3afc79 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/dont_rename/__main__.py @@ -0,0 +1,16 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. +import __init__
\ No newline at end of file diff --git a/gazelle/python/testdata/naming_convention/dont_rename/__test__.py b/gazelle/python/testdata/naming_convention/dont_rename/__test__.py new file mode 100644 index 0000000..a3afc79 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/dont_rename/__test__.py @@ -0,0 +1,16 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. +import __init__
\ No newline at end of file diff --git a/gazelle/python/testdata/naming_convention/resolve_conflict/BUILD.in b/gazelle/python/testdata/naming_convention/resolve_conflict/BUILD.in new file mode 100644 index 0000000..c81e735 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/resolve_conflict/BUILD.in @@ -0,0 +1,5 @@ +go_library(name = "resolve_conflict") + +go_binary(name = "resolve_conflict_bin") + +go_test(name = "resolve_conflict_test") diff --git a/gazelle/python/testdata/naming_convention/resolve_conflict/BUILD.out b/gazelle/python/testdata/naming_convention/resolve_conflict/BUILD.out new file mode 100644 index 0000000..3fa5de2 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/resolve_conflict/BUILD.out @@ -0,0 +1,31 @@ +load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test") + +go_library(name = "resolve_conflict") + +go_binary(name = "resolve_conflict_bin") + +go_test(name = "resolve_conflict_test") + +py_library( + name = "my_resolve_conflict_library", + srcs = ["__init__.py"], + imports = [".."], + visibility = ["//:__subpackages__"], +) + +py_binary( + name = "my_resolve_conflict_binary", + srcs = ["__main__.py"], + imports = [".."], + main = "__main__.py", + visibility = ["//:__subpackages__"], + deps = [":my_resolve_conflict_library"], +) + +py_test( + name = "my_resolve_conflict_test", + srcs = ["__test__.py"], + imports = [".."], + main = "__test__.py", + deps = [":my_resolve_conflict_library"], +) diff --git a/gazelle/python/testdata/naming_convention/resolve_conflict/__init__.py b/gazelle/python/testdata/naming_convention/resolve_conflict/__init__.py new file mode 100644 index 0000000..7307559 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/resolve_conflict/__init__.py @@ -0,0 +1,15 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. diff --git a/gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py b/gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py new file mode 100644 index 0000000..a3afc79 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/resolve_conflict/__main__.py @@ -0,0 +1,16 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. +import __init__
\ No newline at end of file diff --git a/gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py b/gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py new file mode 100644 index 0000000..a3afc79 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/resolve_conflict/__test__.py @@ -0,0 +1,16 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# For test purposes only. +import __init__
\ No newline at end of file diff --git a/gazelle/python/testdata/naming_convention/test.yaml b/gazelle/python/testdata/naming_convention/test.yaml new file mode 100644 index 0000000..fcea777 --- /dev/null +++ b/gazelle/python/testdata/naming_convention/test.yaml @@ -0,0 +1,15 @@ +# Copyright 2023 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- |