diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 94da454..5d3bda5 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -9,7 +9,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.11] + python-version: [3.12] steps: - name: Checkout Code diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index c5b41ea..854ac4c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -27,7 +27,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.11] + python-version: [3.12] steps: - name: Checkout Code diff --git a/.github/workflows/pep.yaml b/.github/workflows/pep.yaml index e7a1e73..c2410d1 100644 --- a/.github/workflows/pep.yaml +++ b/.github/workflows/pep.yaml @@ -9,7 +9,7 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: [3.11] + python-version: [3.12] steps: - name: Checkout Code diff --git a/.github/workflows/pypi.yaml b/.github/workflows/pypi.yaml index 0d092e7..2111783 100644 --- a/.github/workflows/pypi.yaml +++ b/.github/workflows/pypi.yaml @@ -18,7 +18,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v2 with: - python-version: 3.11 + python-version: 3.12 - name: Check Release Tag run: | python3 ci/check_version_number.py ${{ github.event.release.tag_name }} @@ -36,4 +36,3 @@ jobs: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} TWINE_REPOSITORY: pypi - \ No newline at end of file diff --git a/test/test_order.py b/test/test_order.py index 838fc72..cd5e3fc 100644 --- a/test/test_order.py +++ b/test/test_order.py @@ -9,11 +9,11 @@ from test_api import InvenTreeTestCase # noqa: E402 -from inventree.base import Attachment # noqa: E402 from inventree import company # noqa: E402 from inventree import order # noqa: E402 from inventree import part # noqa: E402 from inventree import stock # noqa: E402 +from inventree.base import Attachment # noqa: E402 class POTest(InvenTreeTestCase): @@ -84,7 +84,7 @@ def test_po_create(self): n = len(order.PurchaseOrder.list(self.api)) # Create a PO with unique reference - ref = f"PO-{n+1}" + ref = f"PO-{n + 1}" po = supplier.createPurchaseOrder( reference=ref, @@ -284,6 +284,9 @@ def test_order_complete_with_receive(self): result = po.receiveAll(location=use_location) self.assertIsNone(result) + # hold the order, then complete it + po._statusupdate(status='hold') + # Complete the order, do not accept any incomplete lines po.complete(accept_incomplete=False) po.reload() @@ -396,7 +399,7 @@ def test_po_attachment(self): def test_invalid_list(self): """Test list with an invalid parameter. - + Ref: https://github.com/inventree/inventree-python/issues/246 """ @@ -405,7 +408,7 @@ def test_invalid_list(self): results = order.PurchaseOrder.list(self.api, project_code=999999999) self.assertEqual(len(results), 0) - # Try the same again, but raise the eror + # Try the same again, but raise the error with self.assertRaises(HTTPError): results = order.PurchaseOrder.list( self.api, @@ -418,7 +421,7 @@ def test_invalid_list(self): # Create a new project code pc = ProjectCode.create(self.api, { - 'code': f"TEST-{n+1}", + 'code': f"TEST-{n + 1}", 'description': 'Test project code', }) @@ -619,7 +622,7 @@ def test_so_shipment(self): shipment_1 = order.SalesOrderShipment.create( self.api, data={ 'order': so.pk, - 'reference': f'Package {num_shipments+1}' + 'reference': f'Package {num_shipments + 1}' } ) @@ -639,7 +642,7 @@ def test_so_shipment(self): shipment_2 = so.addShipment(f'Package {num_shipments}') # Create new shipment - use addShipment method. No extra data - shipment_2 = so.addShipment(f'Package {num_shipments+1}') + shipment_2 = so.addShipment(f'Package {num_shipments + 1}') # Assert the shipment is not created self.assertIsNotNone(shipment_2) @@ -648,7 +651,7 @@ def test_so_shipment(self): self.assertEqual(shipment_2.getOrder().pk, so.pk) # Assert shipment reference is as expected - self.assertEqual(shipment_2.reference, f'Package {num_shipments+1}') + self.assertEqual(shipment_2.reference, f'Package {num_shipments + 1}') # Count number of current shipments self.assertEqual(len(so.getShipments()), num_shipments + 1) @@ -657,11 +660,11 @@ def test_so_shipment(self): # Create another shipment - use addShipment method. # With some extra data, including non-sense order # (which should be overwritten) - notes = f'Test shipment number {num_shipments+1} for order {so.pk}' + notes = f'Test shipment number {num_shipments + 1} for order {so.pk}' tracking_number = '93414134343' shipment_2 = so.addShipment( - reference=f'Package {num_shipments+1}', + reference=f'Package {num_shipments + 1}', order=10103413, notes=notes, tracking_number=tracking_number @@ -674,7 +677,7 @@ def test_so_shipment(self): self.assertEqual(shipment_2.getOrder().pk, so.pk) # Assert shipment reference is as expected - self.assertEqual(shipment_2.reference, f'Package {num_shipments+1}') + self.assertEqual(shipment_2.reference, f'Package {num_shipments + 1}') # Make sure extra data is also as expected self.assertEqual(shipment_2.tracking_number, tracking_number) @@ -729,11 +732,11 @@ def test_so_shipment(self): if len(allocations) == 0: shp.delete() continue - + # If the shipment has no date, try to mark it shipped if shp.shipment_date is None: shp.ship() - + so.complete() self.assertEqual(so.status, 20) self.assertEqual(so.status_text, 'Shipped')