Refactor test scripts.
Move helper classes to test_helper folder. Only test case files
in the first level.
Test: atest -v CtsSeekerDiscoverProviderTest
BUG: 214015364
Change-Id: I088adcb647d01ac558ce7dd1fea880821d59028e
diff --git a/nearby/tests/multidevices/host/Android.bp b/nearby/tests/multidevices/host/Android.bp
index b0adfba..bad8a26 100644
--- a/nearby/tests/multidevices/host/Android.bp
+++ b/nearby/tests/multidevices/host/Android.bp
@@ -37,6 +37,5 @@
python_library_host {
name: "NearbyMultiDevicesHostHelper",
- srcs: ["*.py"],
- exclude_srcs: ["*_test.py"],
+ srcs: ["test_helper/*.py"],
}
\ No newline at end of file
diff --git a/nearby/tests/multidevices/host/seeker_discover_provider_test.py b/nearby/tests/multidevices/host/seeker_discover_provider_test.py
index 32976c1..03f3661 100644
--- a/nearby/tests/multidevices/host/seeker_discover_provider_test.py
+++ b/nearby/tests/multidevices/host/seeker_discover_provider_test.py
@@ -1,16 +1,28 @@
-# Lint as: python3
+# Copyright (C) 2022 The Android Open Source Project
+#
+# 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.
+
"""CTS-V Nearby Mainline Fast Pair end-to-end test case: seeker can discover the provider."""
import logging
import sys
-from mobly import asserts
from mobly import base_test
from mobly import test_runner
from mobly.controllers import android_device
-import fast_pair_provider_simulator
-import fast_pair_seeker
+from test_helper import fast_pair_provider_simulator
+from test_helper import fast_pair_seeker
# Default model ID to simulate on provider side.
DEFAULT_MODEL_ID = '00000C'
diff --git a/nearby/tests/multidevices/host/test_helper/__init__.py b/nearby/tests/multidevices/host/test_helper/__init__.py
new file mode 100644
index 0000000..b0cae91
--- /dev/null
+++ b/nearby/tests/multidevices/host/test_helper/__init__.py
@@ -0,0 +1,13 @@
+# Copyright (C) 2022 The Android Open Source Project
+#
+# 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.
diff --git a/nearby/tests/multidevices/host/event_helper.py b/nearby/tests/multidevices/host/test_helper/event_helper.py
similarity index 78%
rename from nearby/tests/multidevices/host/event_helper.py
rename to nearby/tests/multidevices/host/test_helper/event_helper.py
index a642246..8abf05c 100644
--- a/nearby/tests/multidevices/host/event_helper.py
+++ b/nearby/tests/multidevices/host/test_helper/event_helper.py
@@ -1,3 +1,17 @@
+# Copyright (C) 2022 The Android Open Source Project
+#
+# 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.
+
"""This is a shared library to help handling Mobly event waiting logic."""
import time
diff --git a/nearby/tests/multidevices/host/fast_pair_provider_simulator.py b/nearby/tests/multidevices/host/test_helper/fast_pair_provider_simulator.py
similarity index 91%
rename from nearby/tests/multidevices/host/fast_pair_provider_simulator.py
rename to nearby/tests/multidevices/host/test_helper/fast_pair_provider_simulator.py
index 37ba387..8563e8e 100644
--- a/nearby/tests/multidevices/host/fast_pair_provider_simulator.py
+++ b/nearby/tests/multidevices/host/test_helper/fast_pair_provider_simulator.py
@@ -1,3 +1,17 @@
+# Copyright (C) 2022 The Android Open Source Project
+#
+# 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.
+
"""Fast Pair provider simulator role."""
from mobly import asserts
@@ -5,7 +19,7 @@
from mobly.controllers.android_device_lib import snippet_event
import retry
-import event_helper
+from test_helper import event_helper
# The package name of the provider simulator snippet.
FP_PROVIDER_SIMULATOR_SNIPPETS_PACKAGE = 'android.nearby.multidevices'
diff --git a/nearby/tests/multidevices/host/fast_pair_seeker.py b/nearby/tests/multidevices/host/test_helper/fast_pair_seeker.py
similarity index 84%
rename from nearby/tests/multidevices/host/fast_pair_seeker.py
rename to nearby/tests/multidevices/host/test_helper/fast_pair_seeker.py
index df02f51..85c37df 100644
--- a/nearby/tests/multidevices/host/fast_pair_seeker.py
+++ b/nearby/tests/multidevices/host/test_helper/fast_pair_seeker.py
@@ -1,10 +1,24 @@
+# Copyright (C) 2022 The Android Open Source Project
+#
+# 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.
+
"""Fast Pair seeker role."""
from mobly import asserts
from mobly.controllers import android_device
from mobly.controllers.android_device_lib import snippet_event
-import event_helper
+from test_helper import event_helper
# The package name of the Nearby Mainline Fast Pair seeker Mobly snippet.
FP_SEEKER_SNIPPETS_PACKAGE = 'android.nearby.multidevices'