aboutcode-org / python-inspector

Inspect Python code and PyPI package manifests. Resolve Python dependencies.
22 stars 19 forks source link

Merge latest skeleton in python-inspector #119

Closed swastkk closed 1 year ago

swastkk commented 1 year ago

Merged the template skeleton into python-inspector project. SIgned-off-by: swastik swastkk@gmail.com

swastkk commented 1 year ago

@TG1999 review please :)

TG1999 commented 1 year ago

@swastkk tests are failing, please look into this

swastkk commented 1 year ago

@swastkk tests are failing, please look into this

okay :)

swastkk commented 1 year ago

Can you please help in solving these errors, actually solved the errors which were in resolution.py by changing the versions of the packages mentioned there, but in these errors, I am not able to find where to make changes. Thanks in advance.

======================================== short test summary info =========================================
FAILED tests/test_api.py::test_api_with_specifier - assert {'files': [],\n 'packages': [{'api_data_url'...
FAILED tests/test_api.py::test_api_with_specifier_pdt - assert {'files': [],\n 'packages': [{'api_data_...
FAILED tests/test_api.py::test_api_with_requirement_file - assert {'files': [{'package_data': [{'api_da...
FAILED tests/test_api.py::test_api_with_prefer_source - assert {'files': [],\n 'packages': [{'api_data_...
FAILED tests/test_api.py::test_api_with_python_311 - assert {'files': [],\n 'packages': [{'api_data_url...
FAILED tests/test_cli.py::test_pdt_output_with_pinned_requirements - assert {'files': [{'package_data':...
FAILED tests/test_cli.py::test_pdt_output_with_frozen_requirements - assert {'files': [{'package_data':...
FAILED tests/test_cli.py::test_cli_with_single_index_url_except_pypi_simple - assert {'files': [],\n 'h...
FAILED tests/test_cli.py::test_cli_with_azure_devops_with_python_310 - assert {'files': [{'package_data...
FAILED tests/test_cli.py::test_cli_with_azure_devops_with_python_38 - assert {'files': [{'package_data'...
FAILED tests/test_cli.py::test_cli_with_pinned_requirements_file - assert {'files': [{'package_data': [...
======================= 11 failed, 112 passed, 1352 warnings in 299.90s (0:04:59) ========================
swastkk commented 1 year ago

like was having this error

tests/test_api.py:101:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

result_file = '/tmp/scancode-tk-tests -rsjax3qe/4kwmmz7f/td/tf.json'
expected_file = '/home/swastik/Desktop/Projects/python-inspector/tests/data/test-api-with-prefer-source.json'
clean = True, regen = False

    def check_json_results(result_file, expected_file, clean=True, regen=REGEN_TEST_FIXTURES):
        """
        Check the ``result_file`` JSON results against the ``expected_file``
        expected JSON results.

        If ``clean`` is True, remove headers data that can change across runs to
        provide stable test resultys.

        If ``regen`` is True the expected_file WILL BE overwritten with the new
        results from ``results_file``. This is convenient for updating tests
        expectations.
        """
        with open(result_file) as res:
            results = json.load(res)
        if regen:
            with open(expected_file, "w") as reg:
                json.dump(results, reg, indent=2, separators=(",", ": "))
            expected = results
        else:
            with open(expected_file) as res:
                expected = json.load(res)

                if clean:
                    clean_results(expected)
        if clean:
            results = clean_results(results)
>       assert results == expected
E       AssertionError: assert {'files': [],...zeug@2.2.2'}]} == {'files': [],...zeug@2.2.2'}]}
E         Omitting 1 identical items, use -vv to show
E         Differing items:
E         {'resolution': [{'dependencies': [], 'package': 'pkg:pypi/click@8.1.3'}, {'dependencies': ['pkg:pypi/click@8.1.3', 'pk...: 'pkg:pypi/markupsafe@2.1.2'}, {'dependencies': ['pkg:pypi/markupsafe@2.1.2'], 'package': 'pkg:pypi/werkzeug@2.2.2'}]} != {'resolution': [{'dependencies': [], 'package': 'pkg:pypi/click@8.1.3'}, {'dependencies': ['pkg:pypi/click@8.1.3', 'pk...: 'pkg:pypi/markupsafe@2.1.1'}, {'dependencies': ['pkg:pypi/markupsafe@2.1.1'], 'package': 'pkg:pypi/werkzeug@2.2.2'}]}
E         {'packages': [{'api_data_url': 'h...
E
E         ...Full output truncated (2 lines hidden), use '-vv' to show

tests/test_cli.py:495: AssertionError

how to approach these type of errors...?

TG1999 commented 1 year ago

@swastkk you can regen the test output by running these commands

$ source venv/bin/activate
$ PYINSP_REGEN_TEST_FIXTURES=yes pytest -vvs
swastkk commented 1 year ago

@swastkk you can regen the test output by running these commands

$ source venv/bin/activate
$ PYINSP_REGEN_TEST_FIXTURES=yes pytest -vvs

Yep, its done with all tests passing Thanks :)

TG1999 commented 1 year ago

@swastkk please squash commits from https://github.com/nexB/python-inspector/pull/119/commits/37d6d74ee51b9fca53a2637d01af425bdb422382 to https://github.com/nexB/python-inspector/pull/119/commits/440b1ea9dcd67df48208888cc2a714a20f5a6f8d

swastkk commented 1 year ago

@swastkk please squash commits from 37d6d74 to 440b1ea

Actually while squashing with rebase, getting merge issues with the previous commits as well, so what to do now?

git rebase -i HEAD~10
Auto-merging tests/test_resolution.py
CONFLICT (content): Merge conflict in tests/test_resolution.py
error: could not apply 9383d32... Fix tests to reflect correct dependencies.
hint: Resolve all conflicts manually, mark them as resolved with
hint: "git add/rm <conflicted_files>", then run "git rebase --continue".
hint: You can instead skip this commit: run "git rebase --skip".
hint: To abort and get back to the state before "git rebase", run "git rebase --abort".
Could not apply 9383d32... Fix tests to reflect correct dependencies.
swastkk commented 1 year ago

@swastkk please squash commits from 37d6d74 to 440b1ea

Done :)

TG1999 commented 1 year ago

@swastkk thanks please squash these 2 as well https://github.com/nexB/python-inspector/pull/119/commits/37d6d74ee51b9fca53a2637d01af425bdb422382 and https://github.com/nexB/python-inspector/pull/119/commits/fd7236ac8034bf47a56b32cd7db2c3fcb00a9ca8

swastkk commented 1 year ago

@swastkk thanks please squash these 2 as well 37d6d74 and fd7236a

Actually I am unable to find this 37d6d74 on my system as this commit was a merge commit of remote skeleton as

commit 37d6d74ee51b9fca53a2637d01af425bdb422382
Merge: f2b19f9 1205bc0
Author: swastik <swastkk@gmail.com>
Date:   Wed Jan 18 19:09:19 2023 +0530

    Aligning project with Template skeleton

    Signed-off-by: swastik <swastkk@gmail.com>

So, how to handel please share...

swastkk commented 1 year ago

@TG1999 Review please :)

TG1999 commented 1 year ago

@swastkk please rebase your branch

swastkk commented 1 year ago

@swastkk please rebase your branch

Sure, but for the rebase i have to pull the latest changes right? but it seems that the latest changes can't be fetched from the main branch

Screenshot_2023-04-11_19-11-44 Screenshot_2023-04-11_19-15-03

and after writing command getting this- Screenshot_2023-04-11_19-13-58

TG1999 commented 1 year ago

@swastkk please don't use main branch for PR purposes, instead always cut out a branch and make PR from that. Please run git remote -v and show the output for same here.

swastkk commented 1 year ago

Getting this after git remote -v

git remote -v
origin  https://github.com/swastkk/python-inspector (fetch)
origin  https://github.com/swastkk/python-inspector (push)
skeleton    git@github.com:nexB/skeleton (fetch)
skeleton    git@github.com:nexB/skeleton (push)
TG1999 commented 1 year ago

Please run these commands:

git remote add upstream https://github.com/nexB/python-inspector
git fetch upstream main
git rebase upstream/main

And let us know if you are able to rebase with this ?

swastkk commented 1 year ago

Please run these commands:

git remote add upstream https://github.com/nexB/python-inspector
git fetch upstream main
git rebase upstream/main

And let us know if you are able to rebase with this ?

Yes rebased, resolved the conflicts. BUT it is asking for a New PR Screenshot_2023-04-11_20-10-44

TG1999 commented 1 year ago

@swastkk you did rebase on which branch ? Can you please run git status and show me the output for the command.

swastkk commented 1 year ago

@swastkk you did rebase on which branch ? Can you please run git status and show me the output for the command.

Ohh my bad, i think i rebased my old branch packvers-added instead of the changes i made in this PR which was in the main branch :"(

swastkk commented 1 year ago

I will rebase it with my main branch and that PR issue will be resolved.

swastkk commented 1 year ago

Done with rebase

I will rebase it with my main branch and that PR issue will be resolved.

Rebase DONE :checkered_flag:

TG1999 commented 1 year ago

@swastkk this PR now has unrelated changes : |

swastkk commented 1 year ago

@swastkk this PR now has unrelated changes : |

What to do now :"( ?

TG1999 commented 1 year ago

@pombredanne what are your thoughts on this ?

pombredanne commented 1 year ago

@pombredanne what are your thoughts on this ?

IMHO there was a snafu during the rebase. The best way is likely to restart anew... from a clean latest main branch base and merging back the latest skeleton again, then force push this

swastkk commented 1 year ago

@pombredanne what are your thoughts on this ?

IMHO there was a snafu during the rebase. The best way is likely to restart anew... from a clean latest main branch base and merging back the latest skeleton again, then force push this

Okay got it, making this PR as Draft for any reference and creating a New PR as soon as possible.

pombredanne commented 1 year ago

gentle ping ... we need the latest skeleton still :)

swastkk commented 1 year ago

Ok I will have a look!

pombredanne commented 1 year ago

@swastkk please sync up with @TG1999 as he may started doing it already.

pombredanne commented 1 year ago

@TG1999 merged a different branch with the same effect, so I am closing this. Thank you ++ for your efforts in all cases that are much appreciated!