Skip to content

Commit 758d0c1

Browse files
committed
Merge pull request #78 from shotgunsoftware/ticket/27732_delete_field_forever_fix_for_schema_field_create_test
For #27732 Fix for the schema_field_create test.
2 parents 70c09ef + c60ebd2 commit 758d0c1

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

tests/test_api_long.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"""
55

66
import base
7+
import random
78

89
class TestShotgunApiLong(base.LiveTestBase):
910

@@ -70,10 +71,21 @@ def test_schema(self):
7071
self.assertTrue(schema, dict)
7172
self.assertTrue(len(schema) > 0)
7273
self.assertTrue("user" in schema)
74+
75+
# An explantion is in order here. the field code that is created in shotgun is based on the human display name
76+
# that is provided , so for example "Money Count" would generate the field code 'sg_monkey_count' . The field
77+
# that is created in this test is retired at the end of the test but when this test is run again against
78+
# the same database ( which happens on our Continous Integration server ) trying to create a new field
79+
# called "Monkey Count" will now fail due to the new Delete Field Forever features we have added to shotgun
80+
# since there will a retired field called sg_monkey_count. The old behavior was to go ahead and create a new
81+
# "Monkey Count" field with a field code with an incremented number of the end like sg_monkey_count_1. The new
82+
# behavior is to raise an error in hopes the user will go into the UI and delete the old retired field forever.
83+
84+
# make a the name of the field somewhat unique
85+
human_field_name = "Monkey " + str(random.getrandbits(24))
7386

7487
properties = { "description" : "How many monkeys were needed" }
75-
new_field_name = self.sg.schema_field_create("Version", "number",
76-
"Monkey Count",
88+
new_field_name = self.sg.schema_field_create("Version", "number", human_field_name,
7789
properties=properties)
7890

7991
properties = {"description" : "How many monkeys turned up"}

0 commit comments

Comments
 (0)