Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions python/pyspark/resource/tests/test_connect_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@

from pyspark.resource import ResourceProfileBuilder, TaskResourceRequests, ExecutorResourceRequests
from pyspark.sql import SparkSession
from pyspark.testing.sqlutils import have_pandas, pandas_requirement_message
from pyspark.testing.connectutils import (
should_test_connect,
connect_requirement_message,
)


@unittest.skipIf(not have_pandas, pandas_requirement_message)
@unittest.skipIf(not should_test_connect, connect_requirement_message)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

should_test_connect covers more edge cases than have_pandas.

class ResourceProfileTests(unittest.TestCase):
def test_profile_before_sc_for_connect(self):
rpb = ResourceProfileBuilder()
Expand Down
13 changes: 11 additions & 2 deletions python/pyspark/resource/tests/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,16 @@
# limitations under the License.
#
import unittest
from typing import cast

from pyspark.resource import ExecutorResourceRequests, ResourceProfileBuilder, TaskResourceRequests
from pyspark.sql import SparkSession
from pyspark.testing.sqlutils import have_pandas, pandas_requirement_message
from pyspark.testing.sqlutils import (
have_pandas,
have_pyarrow,
pandas_requirement_message,
pyarrow_requirement_message,
)


class ResourceProfileTests(unittest.TestCase):
Expand Down Expand Up @@ -72,7 +78,10 @@ def assert_request_contents(exec_reqs, task_reqs):
assert_request_contents(rp3.executorResources, rp3.taskResources)
sc.stop()

@unittest.skipIf(not have_pandas, pandas_requirement_message)
@unittest.skipIf(
not have_pandas or not have_pyarrow,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This test has df.mapInArrow(lambda x: x, df.schema, False, rp).collect() too.

cast(str, pandas_requirement_message or pyarrow_requirement_message),
)
def test_profile_before_sc_for_sql(self):
rpb = ResourceProfileBuilder()
treqs = TaskResourceRequests().cpus(2)
Expand Down