Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notifications deprecation errors #1426

Open
brylie opened this issue Oct 11, 2022 · 25 comments
Open

Fix notifications deprecation errors #1426

brylie opened this issue Oct 11, 2022 · 25 comments

Comments

@brylie
Copy link
Member

brylie commented Oct 11, 2022

Description

When running management commands, I see the following deprecation warnings.

/OpenCiviWiki/.venv/lib/python3.10/site-packages/notifications/base/models.py:22: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(get_version()) >= StrictVersion('1.8.0'):
/OpenCiviWiki/.venv/lib/python3.10/site-packages/notifications/views.py:20: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  if StrictVersion(get_version()) >= StrictVersion('1.7.0'):
OpenCiviWiki/.venv/lib/python3.10/site-packages/notifications/urls.py:9: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.

What should have happened?

There should be no deprecation errors when running management commands.

Upstream issue: django-notifications/django-notifications#344

@brylie brylie added triage Issues that have not been categorized or prioritized bug help wanted good first issue code quality hacktoberfest and removed triage Issues that have not been categorized or prioritized labels Oct 11, 2022
@DamyanBG
Copy link

Hello, I want to contirbute.

@brylie
Copy link
Member Author

brylie commented Oct 11, 2022

Thanks, @DamyanBG! I'll assign you to the issue.

@DamyanBG
Copy link

I made a PR.

@DamyanBG
Copy link

I found that my solution is wrong. I closed my PR. I will restart my work.

@brylie
Copy link
Member Author

brylie commented Oct 12, 2022

When creating a pull request that will resolve an issue, please link the pull request to the related issue(s) by using one of the supported keywords followed by the issue number.

For example:

Closes #<issue-number>

Further details

You can link a pull request to an issue by using a supported keyword in the pull request's description or in a commit message.

  • close
  • closes
  • closed
  • fix
  • fixes
  • fixed
  • resolve
  • resolves
  • resolved

@DamyanBG
Copy link

I opened pull request.

@wrightdj99
Copy link

Is this issue still needing work? If so, I could try and help.

@brylie brylie assigned wrightdj99 and unassigned DamyanBG May 31, 2023
@AryanGupta0007
Copy link

Hi i have been trying to solve this issue and set up the project locally while setting up i have a problem as when running poetry install in the root directory i would get this error . pLease Help and please tell if there is any group or channel where i can ask my doubts. . I would get this error in Powershell :
Poetry could not find a pyproject.toml file in C:\Users\panka\Desktop\KIDS\Aryan\Open Source\open Civi Wiki or its parents

@brylie
Copy link
Member Author

brylie commented Jul 1, 2023

What do you see when listing the contents of the directory from where you run the poetry command?

@AryanGupta0007
Copy link

From your message i understand that what files do i see in the directory i am running this install command . The files i see in the directory are :
CODE_OF_CONDUCT.md CONTRIBUTING.md docs/ License.md poetry.lock Procfile project pytest.ini README.md setup.cfg

@AryanGupta0007
Copy link

ok i figured it i wasn't in the root directory on the shell . Thanks for the help

@brylie
Copy link
Member Author

brylie commented Jul 1, 2023

Yes, it appears there is a pyproject.toml in the directory, correct? Can you record a video of your terminal session where you are running those commands? Here is one tool that you can use to record an animated GIF of your PowerShell window: https://gifcap.dev/

@AryanGupta0007
Copy link

AryanGupta0007 commented Jul 1, 2023

does poetry work on git bash?
it always say poetry not found i have added it to path

@AryanGupta0007
Copy link

Recording 2023-07-01 at 17 32 50
see now there is a issue in install pre commit

@AryanGupta0007
Copy link

I think the virtual env is activating as i tried to run the python manage.py migrate command it says django_extensions not installed

@brylie
Copy link
Member Author

brylie commented Jul 1, 2023

Try running poetry shell to activate the virtual environment. Refer to the Poetry documentation for adding poetry to your operating system path:

(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

https://python-poetry.org/docs/#installing-with-the-official-installer

@AryanGupta0007
Copy link

I had already added Poetry to path before posting the comment here. So the issue still persists

@brylie
Copy link
Member Author

brylie commented Jul 1, 2023

Try:

  1. poetry shell
  2. poetry install
  3. pre-commit install

@AryanGupta0007
Copy link

Ya i did the same : still the issue persists
2

@brylie
Copy link
Member Author

brylie commented Jul 1, 2023

Did you try running poetry lock --no-update as the error suggested?

@AryanGupta0007
Copy link

ya i tried it not working still . Sorry for disturbing you again and again . Thank you for the help

@brylie
Copy link
Member Author

brylie commented Jul 1, 2023

Hm, it's genuinely a difficult issue, and I can't help reproduce it since I'm not using PowerShell. It might be good to seek help from the Poetry GitHub issues or StackOverflow, as it seems likely that someone will have encountered a similar issue.

@AryanGupta0007
Copy link

ok thanks!

@KanishkaHalder1771
Copy link

Hi, is this issue still open, I would like to contribute then. Thanks

@KanishkaHalder1771
Copy link

Hi, I am getting a test failure, can someone help on this

Found 36 test(s).
Creating test database for alias 'default'...
System check identified no issues (0 silenced).
..........................F..Not Found: /thread/12345/
.......
======================================================================
FAIL: test_anonymous_users_are_redirected_to_landing_page (threads.tests.test_views.BaseViewTests.test_anonymous_users_are_redirected_to_landing_page)
Whether unauthenticated users are redirected to the landing page
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\Work\OpenSource\OpenCiviWiki\project\threads\tests\test_views.py", line 125, in test_anonymous_users_are_redirected_to_landing_page
    self.assertTemplateUsed(self.response, "base.html")
  File "C:\Users\Kanishka\AppData\Local\pypoetry\Cache\virtualenvs\openciviwiki-IXDF-VAf-py3.11\Lib\site-packages\django\test\testcases.py", line 849, in assertTemplateUsed
    self._assert_template_used(template_name, template_names, msg_prefix, count)
  File "C:\Users\Kanishka\AppData\Local\pypoetry\Cache\virtualenvs\openciviwiki-IXDF-VAf-py3.11\Lib\site-packages\django\test\testcases.py", line 814, in _assert_template_used
    self.assertTrue(
AssertionError: False is not true : Template 'base.html' was not a template used to render the response. Actual template(s) used: landing.html

----------------------------------------------------------------------
Ran 36 tests in 206.326s

I ran the debugger on the test, it seems like in _assert_template_used method these lines:

self.assertTrue(
            template_name in template_names,
            msg_prefix + "Template '%s' was not a template used to render"
            " the response. Actual template(s) used: %s"
            % (template_name, ", ".join(template_names)),
        )

template_name is "base.html" and template_names = ["landing.html"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants