Skip to content
Open
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
4 changes: 2 additions & 2 deletions pypco/pco.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,8 +536,8 @@ def upload(self, file_path: str, **params) -> Optional[dict]: # pylint: disable

def __del__(self):
"""Close the requests session when the PCO object goes out of scope."""

self.session.close()
if self.session is not None:
self.session.close()

@staticmethod
def template(
Expand Down
6 changes: 5 additions & 1 deletion tests/test_pco.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import pypco
from pypco.exceptions import PCORequestTimeoutException, \
PCORequestException, PCOUnexpectedRequestException
PCORequestException, PCOUnexpectedRequestException, PCOCredentialsException
from pypco.auth_config import PCOAuthConfig
from tests import BasePCOTestCase, BasePCOVCRTestCase

Expand Down Expand Up @@ -775,6 +775,10 @@ class TestPCOInitialization(BasePCOTestCase):
def test_pco_initialization(self):
"""Test initializing the PCO object with various combinations of arguments."""

# region no Args:
with self.assertRaises(PCOCredentialsException):
pypco.PCO()

# region Minimal Args: PAT Auth
pco = pypco.PCO(
'app_id',
Expand Down