#36652: Loading squashed migrations from disk raises CircularDependencyError
indeterministically
--------------------------------+------------------------------------------
     Reporter:  Jayden Kneller  |                    Owner:  Augusto Pontes
         Type:  Bug             |                   Status:  assigned
    Component:  Migrations      |                  Version:  dev
     Severity:  Normal          |               Resolution:
     Keywords:  squashed        |             Triage Stage:  Accepted
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------------
Comment (by 허진수):

 If i've understood correctly, the order can be fixed with PYTHONHASHSEED
 env variable. Because Python iterates over set using the location of each
 items, and it is based on the hash value. Python also uses seed to
 randomize the hash results.

 So, it's possible to test using `PYTHONHASHSEED` and `subprocess`. So we
 just need to find the value that causes CircularDependencyError.
 Here is simple example.


 {{{
 class SomeTestClass(TestCase):
     def test():
         ...

 #####
 # other file
 #####
 def some_test_method():
     env_vars = os.environ.copy()
     env_vars['PYTHONHASHSEED'] = '0'
     result = subprocess.run(
         [sys.executable, '-m', 'unittest', 'test_file.py'],
         env=env_vars,
         capture_output=True,
         text=True
     )
 }}}

 I'm not sure if the result will be same, given a fixed `PYTHONHASHSEED`
 env variable.
 If something wrong here, please tell me.
 Actually It's my first time on open source:)
-- 
Ticket URL: <https://code.djangoproject.com/ticket/36652#comment:27>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/django-updates/01070199ed7ea7b9-0156d3d1-8d44-4d09-88f3-98059fcc5969-000000%40eu-central-1.amazonses.com.

Reply via email to