We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
class Dictionary(models.Model): timestamp = models.DateTimeField(default=0)
----> 1 models(Dictionary).example() /usr/local/lib/python3.6/site-packages/hypothesis/searchstrategy/strategies.py in example(self, random) 112 max_shrinks=0, 113 max_iterations=1000, --> 114 database=None 115 ) 116 ) /usr/local/lib/python3.6/site-packages/hypothesis/core.py in find(specifier, condition, settings, random, database_key) 630 database_key=database_key, 631 ) --> 632 runner.run() 633 note_engine_for_statistics(runner) 634 run_time = time.time() - start /usr/local/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py in run(self) 189 with self.settings: 190 try: --> 191 self._run() 192 except RunIsComplete: 193 pass /usr/local/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py in _run(self) 310 self.last_data.status < Status.INTERESTING 311 ): --> 312 self.new_buffer() 313 314 mutator = self._new_mutator() /usr/local/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py in new_buffer(self) 73 distribution(self.random, n) 74 ) ---> 75 self.test_function(self.last_data) 76 self.last_data.freeze() 77 /usr/local/lib/python3.6/site-packages/hypothesis/internal/conjecture/engine.py in test_function(self, data) 79 self.call_count += 1 80 try: ---> 81 self._test_function(data) 82 data.freeze() 83 except StopTest as e: /usr/local/lib/python3.6/site-packages/hypothesis/core.py in template_condition(data) 596 try: 597 data.is_find = True --> 598 result = data.draw(search) 599 data.note(result) 600 success = condition(result) /usr/local/lib/python3.6/site-packages/hypothesis/internal/conjecture/data.py in draw(self, strategy) 103 self.start_example() 104 try: --> 105 return strategy.do_draw(self) 106 finally: 107 if not self.frozen: /usr/local/lib/python3.6/site-packages/hypothesis/extra/django/models.py in do_draw(self, data) 196 try: 197 result, _ = self.model.objects.get_or_create( --> 198 **self.arg_strategy.do_draw(data) 199 ) 200 return result /usr/local/lib/python3.6/site-packages/django/db/models/manager.py in manager_method(self, *args, **kwargs) 83 def create_method(name, method): 84 def manager_method(self, *args, **kwargs): ---> 85 return getattr(self.get_queryset(), name)(*args, **kwargs) 86 manager_method.__name__ = method.__name__ 87 manager_method.__doc__ = method.__doc__ /usr/local/lib/python3.6/site-packages/django/db/models/query.py in get_or_create(self, defaults, **kwargs) 471 self._for_write = True 472 try: --> 473 return self.get(**lookup), False 474 except self.model.DoesNotExist: 475 return self._create_object_from_params(lookup, params) /usr/local/lib/python3.6/site-packages/django/db/models/query.py in get(self, *args, **kwargs) 377 if self.query.can_filter() and not self.query.distinct_fields: 378 clone = clone.order_by() --> 379 num = len(clone) 380 if num == 1: 381 return clone._result_cache[0] /usr/local/lib/python3.6/site-packages/django/db/models/query.py in __len__(self) 236 237 def __len__(self): --> 238 self._fetch_all() 239 return len(self._result_cache) 240 /usr/local/lib/python3.6/site-packages/django/db/models/query.py in _fetch_all(self) 1085 def _fetch_all(self): 1086 if self._result_cache is None: -> 1087 self._result_cache = list(self.iterator()) 1088 if self._prefetch_related_lookups and not self._prefetch_done: 1089 self._prefetch_related_objects() /usr/local/lib/python3.6/site-packages/django/db/models/query.py in __iter__(self) 52 # Execute the query. This will also fill compiler.select, klass_info, 53 # and annotations. ---> 54 results = compiler.execute_sql() 55 select, klass_info, annotation_col_map = (compiler.select, compiler.klass_info, 56 compiler.annotation_col_map) /usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py in execute_sql(self, result_type) 822 result_type = NO_RESULTS 823 try: --> 824 sql, params = self.as_sql() 825 if not sql: 826 raise EmptyResultSet /usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py in as_sql(self, with_limits, with_col_aliases, subquery) 374 from_, f_params = self.get_from_clause() 375 --> 376 where, w_params = self.compile(self.where) if self.where is not None else ("", []) 377 having, h_params = self.compile(self.having) if self.having is not None else ("", []) 378 params = [] /usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py in compile(self, node, select_format) 351 sql, params = vendor_impl(self, self.connection) 352 else: --> 353 sql, params = node.as_sql(self, self.connection) 354 if select_format and not self.subquery: 355 return node.output_field.select_format(self, sql, params) /usr/local/lib/python3.6/site-packages/django/db/models/sql/where.py in as_sql(self, compiler, connection) 77 for child in self.children: 78 try: ---> 79 sql, params = compiler.compile(child) 80 except EmptyResultSet: 81 empty_needed -= 1 /usr/local/lib/python3.6/site-packages/django/db/models/sql/compiler.py in compile(self, node, select_format) 351 sql, params = vendor_impl(self, self.connection) 352 else: --> 353 sql, params = node.as_sql(self, self.connection) 354 if select_format and not self.subquery: 355 return node.output_field.select_format(self, sql, params) /usr/local/lib/python3.6/site-packages/django/db/models/lookups.py in as_sql(self, compiler, connection) 154 def as_sql(self, compiler, connection): 155 lhs_sql, params = self.process_lhs(compiler, connection) --> 156 rhs_sql, rhs_params = self.process_rhs(compiler, connection) 157 params.extend(rhs_params) 158 rhs_sql = self.get_rhs_op(connection, rhs_sql) /usr/local/lib/python3.6/site-packages/django/db/models/lookups.py in process_rhs(self, compiler, connection) 90 return '(' + sql + ')', params 91 else: ---> 92 return self.get_db_prep_lookup(value, connection) 93 94 def rhs_is_direct_value(self): /usr/local/lib/python3.6/site-packages/django/db/models/lookups.py in get_db_prep_lookup(self, value, connection) 180 [get_db_prep_value(v, connection, prepared=True) for v in value] 181 if self.get_db_prep_lookup_value_is_iterable else --> 182 [get_db_prep_value(value, connection, prepared=True)] 183 ) 184 /usr/local/lib/python3.6/site-packages/django/db/models/fields/__init__.py in get_db_prep_value(self, value, connection, prepared) 1437 if not prepared: 1438 value = self.get_prep_value(value) -> 1439 return connection.ops.adapt_datetimefield_value(value) 1440 1441 def value_to_string(self, obj): /usr/local/lib/python3.6/site-packages/django/db/backends/mysql/operations.py in adapt_datetimefield_value(self, value) 147 value = timezone.make_naive(value, self.connection.timezone) 148 else: --> 149 raise ValueError("MySQL backend does not support timezone-aware datetimes when USE_TZ is False.") 150 151 if not self.connection.features.supports_microsecond_precision: ValueError: MySQL backend does not support timezone-aware datetimes when USE_TZ is False.
$ python --version Python 3.6.0 $ pip freeze | grep hypothesis hypothesis==3.6.1
The text was updated successfully, but these errors were encountered:
Hmm. That's interesting.
It looks like the real bug here is that hypothesis is not (by default) respecting the Django USE_TZ setting. Good catch, thanks.
Sorry, something went wrong.
FWIW you can work around this until it's fixed by explicitly passing in a datetimes(timezone=None) for the relevant fields.
datetimes(timezone=None)
Zac-HD
No branches or pull requests
The text was updated successfully, but these errors were encountered: